UserManagementController

Extends\LSBaseController

Class LSBaseController

this controller will have all the necessary methods from the old AdminController

package

Default

Methods

Basic initialiser to the base controller class

__construct(string $id,\CWebModule $module = null)
inherited
access

public

Arguments

$id

string

$module

\CWebModule

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

_checkInstallation(): void
inherited
access

protected

_init

_init()
inherited

accessRules

accessRules()

Opens the modal to add dummy users

actionAddDummyUser(): string
Throws
\CException

Response

string

Open modal to edit, or create a new user

actionAddEditUser(integer $userid = null): string
Throws
\CException

Arguments

$userid

integer

Response

string

Opens the modal to add dummy users

actionAddRole(): string
Throws
\CException

Response

string

Stores changes to user, or triggers userCreateEvent

actionApplyEdit(): string
Throws
\CException
\PHPMailer\PHPMailer\Exception

Response

string

| JSON

Mass edition apply roles

actionBatchAddGroup(): string
Throws
\CException
\CHttpException

Response

string

Mass edition apply roles

actionBatchApplyRoles(): string
Throws
\CException

Response

string

Stores the permission settings run via MassEdit

actionBatchPermissions(): string
Throws
\CException

Response

string

Method to resend a password to selected surveyadministrators (MassAction)

actionBatchSendAndResetLoginData(): String
Throws
\CException
\PHPMailer\PHPMailer\Exception

Response

String

Deletes a user after confirmation

actionDeleteConfirm(): void|string
Throws
\CException

Response

void|string

Delete multiple users selected by massive action

actionDeleteMultiple(): void|string
Throws
\CException
\CHttpException

Response

void|string

Export users with specific format (json or csv)

actionExportUser(string $outputFormat,integer $uid): mixed
Throws
\CException

Arguments

$outputFormat

string

json or csv

$uid

integer

userId

Response

mixed

Creates users from an uploaded CSV / JSON file

actionImportUsers(\string $importFormat = 'csv'): string
Throws
\CException

Arguments

$importFormat

\string

Response

string

actionIndex

actionIndex(): string|array<mixed,string>|null
Throws
\CException

Response

string|array<mixed,string>|null

render selected items for massive action modal

actionRenderSelectedItems(): void
Throws
\CHttpException
\CException

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

actionRenderUserImport(string $importFormat = 'csv'): string
Throws
\CException

Arguments

$importFormat

string

  • Importformat (csv/json) to render

Response

string

Creates a batch of dummy users

actionRunAddDummyUser(): string
Throws
\CException

Response

string

| JSON

Save role of user

actionSaveRole(): string
Throws
\CException

Response

string

Stores the changed permissions

actionSaveThemePermissions(): string
Throws
\CException

Response

string

| JSON

Stores the changed permissions

actionSaveUserPermissions(): string
Throws
\CException

Response

string

| JSON

Takes ownership on user after confirmation

actionTakeOwnership(): void
Throws
\CException

Opens a modal to edit user permissions

actionUserPermissions(): string
Throws
\CException

Response

string

Opens a modal to edit user template permissions

actionUserTemplatePermissions(): string
Throws
\CException

Response

string

Show some user detail and statistics

actionViewUser( $userid): string
Throws
\CException

Arguments

$userid

int

Response

string

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

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

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

Arguments

$iUserId

integer

$aPermissionArray

array

Response

array

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

beforeRender(string $view): boolean
inherited

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

Arguments

$view

string

Response

boolean

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

createAbsoluteUrl(string $route,array $params = array(),string $schema = '',string $ampersand = '&'): string
inherited

Arguments

$route

string

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

$params

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.

Response

string

the constructed URL

this method creates a new admin user

createAdminUser(array $aUser): string
Throws
\CException
\PHPMailer\PHPMailer\Exception

Arguments

$aUser

array

Response

string

Create new user

createNewUser(array $aUser): array
Throws
\CException

Arguments

$aUser

array

array with user details

Response

array

returns all attributes from model user as an array

Deletes a user

deleteUser(integer $uid): boolean
Throws
\CException

Arguments

$uid

integer

Response

boolean

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

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

Response

string

Creates a random unique username using prefix

getRandomUsername(string $prefix): string

todo this should be moved to model user ...

Arguments

$prefix

string

the prefix to be used

Response

string

Loads a helper

loadHelper(string $helper): void
inherited
access

public

Arguments

$helper

string

Loads a library

loadLibrary(string $library): void
inherited
access

public

Arguments

$library

string

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

Loads page states from a hidden input.

loadPageStates(): array
inherited

Response

array

the loaded page states

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

renderErrors(array $errors): string

Arguments

$errors

array

Response

string

$errorDiv

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

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

Arguments

$aData

array

$success

Resets the password for one user

resetLoginData(\User &$oUser,boolean $sendMail = false): array
Throws
\CException
\PHPMailer\PHPMailer\Exception

Arguments

$oUser

\User

User model

$sendMail

boolean

Send a mail to the user

Response

array

[success, uid, username, password]

Checks for action specific authorization and then executes an action

run(string $action): void
inherited

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

access

public

Throws
\CException
\CHttpException

Arguments

$action

string

Send the registration email to a new survey administrator

sendAdminMail(array $aUser,string $type = 'registration'): \LimeMailer
TODO

: make this user configurable by TWIG, or similar

Throws
\PHPMailer\PHPMailer\Exception

Arguments

$aUser

array

$type

string

two types are available 'resetPassword' or 'registration', default is 'registration'

Response

\LimeMailer

if send is successfull

Load and set session vars

sessionControl(): void
inherited

todo REFACTORING see comments in mehtod

access

protected

Update admin-user

updateAdminUser(array $aUser): object

REFACTORED (in UserManagementController)

Throws
\CException

Arguments

$aUser

array

array with user details

Response

object

user - updated user object

Properties

this is needed for the preview rendering inside the questioneditor

sTemplate :null
inherited
var

this is needed for the preview rendering inside the questioneditor

Type(s)

null

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

aData :array
inherited
var

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

Type(s)

array

userId of the logged in user

userId :integer
inherited
var

userId of the logged in user

Type(s)

integer

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

navData :array
inherited
var

Type(s)

array