LimeSurvey API - Master branch

UserManagementController extends LSBaseController
in package

Class UserManagementController

Table of Contents

Properties

$aData  : array<string|int, mixed>
$navData  : array<string|int, mixed>
This array contains the survey / group / question id used by the menu widget.
$sTemplate  : null
$userId  : int

Methods

__construct()  : mixed
Basic initialiser to the base controller class
accessRules()  : array<string|int, mixed>
actionActivationConfirm()  : void|string
Show user activation confirmation
actionAddDummyUser()  : mixed
Opens the modal to add dummy users
actionAddEditUser()  : mixed
Open modal to edit, or create a new user
actionAddRole()  : string|null
Opens the modal to add dummy users
actionApplyEdit()  : string
Stores changes to user, or triggers userCreateEvent
actionBatchAddGroup()  : string|null|void
Mass edition apply roles
actionBatchApplyRoles()  : string
Mass edition apply roles
actionBatchPermissions()  : string
Stores the permission settings run via MassEdit
actionBatchSendAndResetLoginData()  : string
Method to resend a password to selected surveyadministrators (MassAction)
actionBatchStatus()  : mixed
Stores the status settings run via MassEdit
actionDeleteConfirm()  : void|string
Show user delete confirmation
actionDeleteMultiple()  : void|string
Delete multiple users selected by massive action
actionDeleteUser()  : void|string
Deletes a user after confirmation
actionExportUser()  : mixed
Export users with specific format (json or csv)
actionImportUsers()  : string
Creates users from an uploaded CSV / JSON file
actionIndex()  : string|array<string|int, string>|null
actionRenderSelectedItems()  : void
render selected items for massive action modal
actionRenderUserImport()  : string
Calls up a modal to import users via csv/json file
actionRunAddDummyUser()  : string
Creates a batch of dummy users
actionSaveRole()  : string|null
Save role of user
actionSaveThemePermissions()  : string
Stores the changed permissions
actionSaveUserPermissions()  : string
Stores the changed permissions
actionTakeOwnership()  : void
Takes ownership on user after confirmation
actionUserActivateDeactivate()  : void|string
Stores the status settings
actionUserPermissions()  : string
Opens a modal to edit user permissions
actionUserTemplatePermissions()  : string|null
Opens a modal to edit user template permissions
actionViewUser()  : string|null
Show some user detail and statistics
createAbsoluteUrl()  : string
Returns an absolute URL based on the given controller and action information.
createNewUser()  : array<string|int, mixed>
Create new user
deleteUser()  : bool
Deletes a user
loadHelper()  : void
Loads a helper
loadLibrary()  : void
Loads a library
loadModel()  : User|null
Returns the data model based on the primary key given in the GET variable.
run()  : void
Checks for action specific authorization and then executes an action
updateAdminUser()  : object
Update admin-user
userActivation()  : array<string|int, mixed>
Activate / deactivate user
_checkInstallation()  : void
Check that installation was already done by looking for config.php Will redirect to the installer script if not exists.
applyPermissionFromArray()  : array<string|int, mixed>
Adds permission to a users Needs an array in the form of [PERMISSIONID][PERMISSION]
beforeRender()  : bool
This part comes from renderWrappedTemplate (not the best way to refactoring, but a temporary solution)
customInit()  : mixed
getRandomString()  : string
Creates a random string
getRandomUsername()  : string
Creates a random unique username using prefix
loadPageStates()  : array<string|int, mixed>
Loads page states from a hidden input.
renderJSON()  : void
Method to render an array as a json document (this one called by a lot of actions in different controllers)
sessionControl()  : void
Load and set session vars
createAdminUser()  : array<string|int, mixed>
This method creates a new admin user and returns success or error message
isAllowedToEdit()  : bool
Check if the current user allowed to update $user
renderErrors()  : string
todo this should not be in a controller, find a better place for it (view)

Properties

$aData

public array<string|int, mixed> $aData = []

import for all new controllers/actions (REFACTORING) to pass data before rendering the content

$navData

This array contains the survey / group / question id used by the menu widget.

public array<string|int, mixed> $navData = array()

$sTemplate

public null $sTemplate = \null

this is needed for the preview rendering inside the questioneditor

Methods

__construct()

Basic initialiser to the base controller class

public __construct(string $id[, CWebModule $module = null ]) : mixed
Parameters
$id : string
$module : CWebModule = null
Tags
access

public

actionActivationConfirm()

Show user activation confirmation

public actionActivationConfirm() : void|string
Tags
throws
CException
Return values
void|string

actionAddDummyUser()

Opens the modal to add dummy users

public actionAddDummyUser() : mixed
Tags
throws
CException

actionAddEditUser()

Open modal to edit, or create a new user

public actionAddEditUser([int|null $userid = null ]) : mixed
Parameters
$userid : int|null = null
Tags
throws
CException

actionAddRole()

Opens the modal to add dummy users

public actionAddRole() : string|null
Tags
throws
CException
Return values
string|null

actionApplyEdit()

Stores changes to user, or triggers userCreateEvent

public actionApplyEdit() : string
Tags
throws
CException
throws
Exception
Return values
string

| JSON

actionBatchAddGroup()

Mass edition apply roles

public actionBatchAddGroup() : string|null|void
Tags
throws
CException
throws
CHttpException
Return values
string|null|void

actionBatchApplyRoles()

Mass edition apply roles

public actionBatchApplyRoles() : string
Tags
throws
CException
Return values
string

actionBatchPermissions()

Stores the permission settings run via MassEdit

public actionBatchPermissions() : string
Tags
throws
CException
Return values
string

actionBatchSendAndResetLoginData()

Method to resend a password to selected surveyadministrators (MassAction)

public actionBatchSendAndResetLoginData() : string
Tags
throws
CException
throws
Exception
Return values
string

actionBatchStatus()

Stores the status settings run via MassEdit

public actionBatchStatus() : mixed
Tags
throws
CException

actionDeleteConfirm()

Show user delete confirmation

public actionDeleteConfirm() : void|string
Tags
throws
CException
Return values
void|string

actionDeleteMultiple()

Delete multiple users selected by massive action

public actionDeleteMultiple() : void|string
Tags
throws
CException
throws
CHttpException
Return values
void|string

actionDeleteUser()

Deletes a user after confirmation

public actionDeleteUser() : void|string
Tags
throws
CException
Return values
void|string

actionExportUser()

Export users with specific format (json or csv)

public actionExportUser(string $outputFormat[, int $uid = 0 ]) : mixed
Parameters
$outputFormat : string

json or csv

$uid : int = 0

userId if 0, all users will be exported

Tags
throws
CException

actionImportUsers()

Creates users from an uploaded CSV / JSON file

public actionImportUsers([string $importFormat = 'csv' ]) : string
Parameters
$importFormat : string = 'csv'
  • format of the imported file - Choice between csv / json
Tags
throws
CException
Return values
string

actionIndex()

public actionIndex() : string|array<string|int, string>|null
Tags
throws
CException
Return values
string|array<string|int, string>|null

actionRenderSelectedItems()

render selected items for massive action modal

public actionRenderSelectedItems() : void
Tags
throws
CHttpException
throws
CException

actionRenderUserImport()

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

public actionRenderUserImport([string $importFormat = 'csv' ]) : string
Parameters
$importFormat : string = 'csv'
  • Importformat (csv/json) to render
Tags
throws
CException
Return values
string

actionRunAddDummyUser()

Creates a batch of dummy users

public actionRunAddDummyUser() : string
Tags
throws
CException
Return values
string

| JSON

actionSaveRole()

Save role of user

public actionSaveRole() : string|null
Tags
throws
CException
Return values
string|null

actionSaveThemePermissions()

Stores the changed permissions

public actionSaveThemePermissions() : string
Tags
throws
CException
Return values
string

| JSON

actionSaveUserPermissions()

Stores the changed permissions

public actionSaveUserPermissions() : string
Tags
throws
CException
Return values
string

| JSON

actionTakeOwnership()

Takes ownership on user after confirmation

public actionTakeOwnership() : void
Tags
throws
CException
Return values
void

| string

actionUserActivateDeactivate()

Stores the status settings

public actionUserActivateDeactivate() : void|string
Tags
throws
CException
Return values
void|string

actionUserPermissions()

Opens a modal to edit user permissions

public actionUserPermissions() : string
Tags
throws
CException
Return values
string

actionUserTemplatePermissions()

Opens a modal to edit user template permissions

public actionUserTemplatePermissions() : string|null
Tags
throws
CException
Return values
string|null

actionViewUser()

Show some user detail and statistics

public actionViewUser(int $userid) : string|null
Parameters
$userid : int
Tags
throws
CException
Return values
string|null

createAbsoluteUrl()

Returns an absolute URL based on the given controller and action information.

public createAbsoluteUrl(string $route[, array<string|int, mixed> $params = array() ][, string $schema = '' ][, string $ampersand = '&' ]) : string

The functionalty was moved to \LSYii_Application::createPublicUrl, to be safe the function remains here.

Parameters
$route : string

the URL route. This should be in the format of 'ControllerID/ActionID'.

$params : array<string|int, mixed> = array()

additional GET parameters (name=>value). Both the name and value will be URL-encoded.

$schema : string = ''

schema to use (e.g. http, https). If empty, the schema used for the current request will be used.

$ampersand : string = '&'

the token separating name-value pairs in the URL.

Return values
string

the constructed URL

createNewUser()

Create new user

public createNewUser(array<string|int, mixed> $aUser) : array<string|int, mixed>
Parameters
$aUser : array<string|int, mixed>

array with user details

Tags
throws
CException
Return values
array<string|int, mixed>

returns all attributes from model user as an array

deleteUser()

Deletes a user

public deleteUser(int $uid) : bool
Parameters
$uid : int
Tags
throws
CException
Return values
bool

loadHelper()

Loads a helper

public loadHelper(string $helper) : void
Parameters
$helper : string
Tags
access

public

loadLibrary()

Loads a library

public loadLibrary(string $library) : void
Parameters
$library : string
Tags
access

public

loadModel()

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

public loadModel(int $id) : User|null

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

Parameters
$id : int

the ID of the model to be loaded

Tags
throws
CHttpException
Return values
User|null

object

run()

Checks for action specific authorization and then executes an action

public run(string $action) : void

TODO: check the dbupdate mechanism, do we really want to check db update before every action??

Parameters
$action : string
Tags
access

public

throws
CException
throws
CHttpException

updateAdminUser()

Update admin-user

public updateAdminUser(array<string|int, mixed> $aUser) : object
Parameters
$aUser : array<string|int, mixed>

array with user details

Tags
throws
CException
Return values
object

user - updated user object

userActivation()

Activate / deactivate user

public userActivation(array<string|int, mixed> $userIds, string $operation) : array<string|int, mixed>
Parameters
$userIds : array<string|int, mixed>
$operation : string

activate or deactivate

Return values
array<string|int, mixed>

_checkInstallation()

Check that installation was already done by looking for config.php Will redirect to the installer script if not exists.

protected _checkInstallation() : void
Tags
access

protected

applyPermissionFromArray()

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

protected applyPermissionFromArray(int $iUserId, array<string|int, mixed> $aPermissionArray) : array<string|int, mixed>

todo REFACTORING this should be moved to model (user or permission)

Parameters
$iUserId : int
$aPermissionArray : array<string|int, mixed>
Return values
array<string|int, mixed>

beforeRender()

This part comes from renderWrappedTemplate (not the best way to refactoring, but a temporary solution)

protected beforeRender(string $view) : bool

todo REFACTORING find all actions that set $aData['surveyid'] and change the layout directly in the action

Parameters
$view : string
Return values
bool

getRandomString()

Creates a random string

protected getRandomString() : string

todo REFACTORING this should be moved to model user ...see getRandomUsername

Return values
string

getRandomUsername()

Creates a random unique username using prefix

protected getRandomUsername(string $prefix) : string

todo this should be moved to model user ...

Parameters
$prefix : string

the prefix to be used

Return values
string

loadPageStates()

Loads page states from a hidden input.

protected loadPageStates() : array<string|int, mixed>
Return values
array<string|int, mixed>

the loaded page states

renderJSON()

Method to render an array as a json document (this one called by a lot of actions in different controllers)

protected renderJSON(array<string|int, mixed> $aData[, mixed $success = true ]) : void
Parameters
$aData : array<string|int, mixed>
$success : mixed = true

sessionControl()

Load and set session vars

protected sessionControl() : void

todo REFACTORING see comments in mehtod

Tags
access

protected

createAdminUser()

This method creates a new admin user and returns success or error message

private createAdminUser(array<string|int, mixed> $aUser[, bool $sendEmail = true ]) : array<string|int, mixed>
Parameters
$aUser : array<string|int, mixed>

array with attributes from user model

$sendEmail : bool = true

true if email should be send, false otherwise

Tags
throws
CException
throws
Exception
Return values
array<string|int, mixed>

isAllowedToEdit()

Check if the current user allowed to update $user

private isAllowedToEdit(mixed $user) : bool
Parameters
$user : mixed
Return values
bool

renderErrors()

todo this should not be in a controller, find a better place for it (view)

private renderErrors(array<string|int, mixed> $errors) : string
Parameters
$errors : array<string|int, mixed>
Return values
string

$errorDiv


        
On this page

Search results