UserManagement

Extends \Survey_Common_Action

Usermanagement Controller

This controller is for the user management panel

package

LimeSurvey

subpackage

Backend

Methods

__construct

__construct( $controller = null,  $id = null) 
inherited

Arguments

$controller

$id

Some functions have different parameters, which are just an alias of the usual parameters we're getting in the url. This function just populates those variables so that we don't end up in an error.

_addPseudoParams(array $params) : array
inherited

This is also used while rendering wrapped template Survey_Common_Action::_renderWrappedTemplate()

Throws
\CHttpException

Arguments

$params

array

Parameters to parse and populate

Response

array

Populated parameters

Browse Menu Bar

_browsemenubar(array $aData) 
inherited

Arguments

$aData

array

Create new user

_createNewUser(array $aUser, boolean $sendMail = true) : object

Arguments

$aUser

array

array with user details

$sendMail

boolean

  • option to send mail to user when created

Response

object

user - created user object

_filterImportedResources

_filterImportedResources(string $extractdir, string $destdir) : array
inherited

Arguments

$extractdir

string

$destdir

string

Response

array

_fullpagebar

_fullpagebar( $aData) 
inherited

Arguments

$aData

_generaltopbar

_generaltopbar( $aData) 
inherited

Arguments

$aData

_generaltopbarAdditions

_generaltopbarAdditions( $aData) 
inherited

Arguments

$aData

listquestion groups

_listquestiongroups(array $aData) 
inherited

Arguments

$aData

array

_listquestions

_listquestions( $aData) 
inherited
Throws
\CException

Arguments

$aData

Display notifications

_notifications() 
inherited

Show admin menu for question group view

_nquestiongroupbar(array $aData) 
inherited

Arguments

$aData

array

?

Survey summary

_nsurveysummary(array $aData) 
inherited

Arguments

$aData

array

Render the save/cancel bar for Organize question groups/questions

_organizequestionbar(array $aData) 
inherited
since 2014-09-30
author

Olle Haerstedt

Arguments

$aData

array

Shows admin menu for question

_questionbar(array $aData) 
inherited

Arguments

$aData

array

Renders template(s) wrapped in header and footer

_renderWrappedTemplate(string $sAction = '', array|string $aViewUrls = array(), array $aData = array(), string|boolean $sRenderFile = false) 
inherited

Addition of parameters should be avoided if they can be added to $aData

NOTE FROM LOUIS : We want to remove this function, wich doesn't respect MVC pattern. The work it's doing should be handle by layout files, and subviews inside views. Eg : for route "admin/survey/sa/listquestiongroups/surveyid/282267" the Group controller should use a main layout (with admin menu bar as a widget), then render the list view, in wich the question group bar is called as a subview.

So for now, we try to evacuate all the renderWrappedTemplate logic (if statements, etc.) to subfunctions, then it will be easier to remove. Comments starting with //// indicate how it should work in the future

Throws
\CHttpException

Arguments

$sAction

string

Current action, the folder to fetch views from

$aViewUrls

array|string

View url(s)

$aData

array

Data to be passed on. Optional.

$sRenderFile

string|boolean

File to be rendered as a layout. Optional.

Send the registration email to a new survey administrator

_sendAdminMail( $type = 'registration', array $aUser,  $newPassword = null) : boolean
TODO

: make this user configurable by TWIG, or similar

Arguments

$type

$aUser

array

$newPassword

Response

boolean

if send is successfull

_showadminmenu() function returns html text for the administration button bar

_showadminmenu( $aData) : string
inherited
access

public

global

string $homedir

string $scriptname

string $surveyid

string $setfont

string $imageurl

int $surveyid

Arguments

$aData

Response

string

Header

_showHeaders(array $aData,  $sendHTTPHeader = true) 
inherited

Arguments

$aData

array

$sendHTTPHeader

Shows admin menu for surveys

_surveybar(array $aData) 
inherited
deprecated

Arguments

$aData

array

Show side menu for survey view

_surveysidemenu(array $aData) 
inherited

Arguments

$aData

array

all the needed data

Show survey summary

_surveysummary(array $aData) 
inherited

Arguments

$aData

array

_titlebar

_titlebar( $aData) 
inherited

Arguments

$aData

Display the update notification

_updatenotification() 
inherited

Load menu bar of user group controller.

_userGroupBar(array $aData) : void
inherited

Arguments

$aData

array

Opens the modal to add dummy users

adddummyuser() : string

Response

string

Opens the modal to add dummy users

addrole() : string

Response

string

Apply role to user

applyaddrole() : string

Response

string

Stores changes to user, or triggers userCreateEvent

applyedit() : string

Response

string

| JSON

CURRENTLY UNUSED Apply global permission from template

applyGlobalPermissionTemplate(\User $oUser, string $permissionclass) : array

Arguments

$oUser

\User

$permissionclass

string

Response

array

Adds permission to a users Needs an array in the form of [PERMISSIONID][PERMISSION]

applyPermissionFromArray(integer $iUserId, array $aPermissionArray) : array

Arguments

$iUserId

integer

$aPermissionArray

array

Response

array

CURRENTLY UNUSED Add a tenplated permission to a users

applyPermissionTemplate(\User $oUser, string $permissionclass, array $entity_ids = array()) : array

Arguments

$oUser

\User

$permissionclass

string

$entity_ids

array

Response

array

CURRENTLY UNUSED Add survey specific permissions by template

applySurveyPermissionTemplate(\User $oUser, string $permissionclass, array $entity_ids) : array

Arguments

$oUser

\User

$permissionclass

string

$entity_ids

array

Response

array

Stores the changed permissions

applythemepermissions() : string

Response

string

| JSON

Mass edition apply group

batchAddGroup() : string

Response

string

Mass edition apply roles

batchApplyRoles() : string
Throws
\CException

Response

string

Stores the permission settings run via MassEdit

batchPermissions() : string

Response

string

Method to resend a password to selected surveyadministrators (MassAction)

batchSendAndResetLoginData() : String

Response

String

Returns content from event beforeSideMenuRender

beforeSideMenuRender(array $aData) : string
inherited

Arguments

$aData

array

Response

string

this method create a new admin user

createAdminUser( $aUser) : string

Arguments

$aUser

Response

string

Deletes a user after confirmation

deleteconfirm() : void

Delete multiple users selected by massive action

deleteMultiple() : void

Deletes a user

deleteUser(integer $uid, boolean $recursive = true) : boolean

Arguments

$uid

integer

$recursive

boolean

Response

boolean

Open modal to edit, or create a new user

editusermodal(integer $userid = null) : string

Arguments

$userid

integer

Response

string

Export users with specific format (json or csv)

exportUser(string $outputFormat, integer $uid) : mixed

Arguments

$outputFormat

string

json or csv

$uid

integer

userId

Response

mixed

Get extra menus from plugins that are using event beforeAdminMenuRender

fetchExtraMenus(array $aData) : \array<ExtraMenu>
inherited

Arguments

$aData

array

Response

\array

Filters special characters to simple ones

filterSpecials(string $in) : string

Arguments

$in

string

String that needs to be changed

Response

string

Creates a random password through the core plugin

getRandomPassword(integer $length = 8) : string

Arguments

$length

integer

Length of the password

Response

string

Creates a random string

getRandomString() : string

Response

string

Erstellt einen zufälligen Benutzernamen mit Präfix

getRandomUsername(string $prefix) : string

Prüft ob der Name einzigartig ist

Arguments

$prefix

string

der Präfix

Response

string

Creates users from an uploaded CSV / JSON file

importUsers(\string $importFormat = 'csv') : string

Arguments

$importFormat

\string

Response

string

index

index() 
inheritdoc

index

index() : void
inherited

Returns the data model based on the primary key given in the GET variable.

loadModel(integer $id) : \User|null

If the data model is not found, an HTTP exception will be raised.

Throws
\CHttpException

Arguments

$id

integer

the ID of the model to be loaded

Response

\User|null

object

Rendering the subviews and views of _renderWrappedTemplate

renderCentralContents(string $sAction, array|string $aViewUrls, array $aData = array()) : string
inherited

Arguments

$sAction

string

$aViewUrls

array|string

$aData

array

Response

string

renderErrors

renderErrors(array $errors) : string

Arguments

$errors

array

Response

string

$errorDiv

renderInternal

renderInternal(string $_viewFile_,  $_data_ = null,  $_return_ = false) 
inherited
inheritdoc

Arguments

$_viewFile_

string

$_data_

$_return_

Method to render an array as a json document

renderJSON(array $aData,  $success = true) : void
inherited

Arguments

$aData

array

$success

Render the quick-menu that is shown when side-menu is hidden.

renderQuickmenu(array $aData) : string
inherited

Only show home-icon for now.

Add support for plugin to attach icon elements using event afterQuickMenuLoad

todo

Make quick-menu user configurable

Arguments

$aData

array

Response

string

render selected items for massive action modal

renderSelectedItems() : void
Throws
\CHttpException
\CException

Calls up a modal to import users via csv/json file

renderUserImport(string $importFormat = 'csv') : string

Arguments

$importFormat

string

  • Importformat (csv/json) to render

Response

string

Resets the password for one user

resetLoginData(\User &$oUser, boolean $sendMail = false) : array

Arguments

$oUser

\User

User model

$sendMail

boolean

Send a mail to the user

Response

array

[success, uid, username, password]

Routes the action into correct subaction

route(string $sa, array<mixed,string> $get_vars) : mixed
inherited
access

protected

Arguments

$sa

string

$get_vars

array<mixed,string>

Response

mixed

Action classes require them to have a run method. We reroute it to index if called.

run() 
inherited

Creates a batch of dummy users

runadddummyuser() : string

Response

string

| JSON

Override runWithParams() implementation in CAction to help us parse requests with subactions.

runWithParams(array $params) : boolean
inherited

Arguments

$params

array

URL Parameters

Response

boolean

Stores the changed permissions

saveuserpermissions() : string

Response

string

| JSON

Takes ownership on user after confirmation

takeownership() : void

Update admin-user

updateAdminUser(array $aUser) : object

Arguments

$aUser

array

array with user details

Response

object

user - updated user object

Opens a modal to edit user permissions

userpermissions() : string

Response

string

Opens a modal to edit user template permissions

usertemplatepermissions() : string

Response

string

Basic view method

view() 

Show some user detail and statistics

viewuser( $userid) : string

Arguments

$userid

Response

string