SurveysGroupsPermissionController
extends LSBaseController
in package
Class SurveysGroupsPermissionController
Table of Contents
Properties
- $aData : array<string|int, mixed>
- $defaultAction : mixed
- By default : just view
- $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>
- It's import to have the accessRules set (security issue).
- actionAddUser() : void
- Add minimal permission (read) to user Show result and allow to set other permissions
- actionAddUserGroup() : void
- Add minimal permission (read) to all users in a group of user Show result and allow to set other permissions
- actionDeleteUser() : void
- Shown permissions list for user (or group)
- actionIndex() : void
- Shown permissions list, allow to add user and group, No action done
- actionSave() : void
- Save current permissions for user (or group) use POST value for user id or group id redirect (in all cas) to surveysgroups permission or to user set permission (permissionsSet function)
- actionViewUser() : void
- Shown permissions list for user
- actionViewUserGroup() : void
- Shown permissions list for user group
- createAbsoluteUrl() : string
- Returns an absolute URL based on the given controller and action information.
- filters() : mixed
- loadHelper() : void
- Loads a helper
- loadLibrary() : void
- Loads a library
- run() : void
- Checks for action specific authorization and then executes an action
- _checkInstallation() : void
- Check that installation was already done by looking for config.php Will redirect to the installer script if not exists.
- beforeRender() : bool
- This part comes from renderWrappedTemplate (not the best way to refactoring, but a temporary solution)
- customInit() : mixed
- 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
- loadModel() : SurveysGroups
- Returns the data model based on the primary key given If the data model is not found, an HTTP exception will be raised.
- viewUserOrUserGroup() : void
- Shown permissions list for user or group
Properties
$aData
public
array<string|int, mixed>
$aData
= []
import for all new controllers/actions (REFACTORING) to pass data before rendering the content
$defaultAction
By default : just view
public
mixed
$defaultAction
= 'index'
$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
$userId
protected
int
$userId
= 0
userId of the logged in user
Methods
__construct()
Basic initialiser to the base controller class
public
__construct(string $id[, CWebModule $module = null ]) : mixed
Parameters
- $id : string
- $module : CWebModule = null
Tags
accessRules()
It's import to have the accessRules set (security issue).
public
accessRules() : array<string|int, mixed>
Only logged in users should have access to actions. All other permissions should be checked in the action itself.
Return values
array<string|int, mixed>actionAddUser()
Add minimal permission (read) to user Show result and allow to set other permissions
public
actionAddUser(int $id) : void
Parameters
- $id : int
-
SurveysGroups id
actionAddUserGroup()
Add minimal permission (read) to all users in a group of user Show result and allow to set other permissions
public
actionAddUserGroup(int $id) : void
Parameters
- $id : int
-
SurveysGroups id
actionDeleteUser()
Shown permissions list for user (or group)
public
actionDeleteUser(int $id, int $uid) : void
Parameters
- $id : int
-
SurveysGroups id
- $uid : int
-
user id
actionIndex()
Shown permissions list, allow to add user and group, No action done
public
actionIndex(int $id) : void
Parameters
- $id : int
-
SurveysGroups id
Tags
actionSave()
Save current permissions for user (or group) use POST value for user id or group id redirect (in all cas) to surveysgroups permission or to user set permission (permissionsSet function)
public
actionSave(int $id) : void
Parameters
- $id : int
-
SurveysGroups id
actionViewUser()
Shown permissions list for user
public
actionViewUser(int $id, int $to) : void
Parameters
- $id : int
-
SurveysGroups id
- $to : int
-
user id
actionViewUserGroup()
Shown permissions list for user group
public
actionViewUserGroup(int $id, int $to) : void
Parameters
- $id : int
-
SurveysGroups id
- $to : int
-
group id
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
filters()
public
filters() : mixed
loadHelper()
Loads a helper
public
loadHelper(string $helper) : void
Parameters
- $helper : string
Tags
loadLibrary()
Loads a library
public
loadLibrary(string $library) : void
Parameters
- $library : string
Tags
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
_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
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
boolcustomInit()
protected
customInit() : mixed
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
loadModel()
Returns the data model based on the primary key given If the data model is not found, an HTTP exception will be raised.
private
loadModel(int $id) : SurveysGroups
Check minimal permission to see
Parameters
- $id : int
-
the ID of the model to be loaded
Tags
Return values
SurveysGroups —the loaded model
viewUserOrUserGroup()
Shown permissions list for user or group
private
viewUserOrUserGroup(int $id, int $to[, string $type = 'user' ]) : void
Parameters
- $id : int
-
SurveysGroups id
- $to : int
-
user or group id
- $type : string = 'user'
-
user or group