LimeSurvey API - Master branch

SurveyPermissions
in package

This class is responsible for the relationship between permissions, users and surveys.

It could be handled as a specific permissions system for surveys.

Table of Contents

Properties

$survey  : Survey
$userControlSameGroupPolicy  : bool

Methods

__construct()  : mixed
SurveyPermissions constructor.
addUserGroupToSurveyPermissions()  : int
Adds users from a group to survey permissions.
addUserToSurveyPermission()  : bool
Adds a user to the survey permissions. This includes that the user gets the permission 'read' for this survey.
deleteUserPermissions()  : int
Deletes all permissions for a user for this survey.
getSurveyUserGroupList()  : array<string|int, mixed>
Return a list (array) of user groups which could still be added to survey permissions.
getSurveyUserList()  : array<string|int, mixed>
Returns a list of users which still not have survey permissions and could be added to survey permissions, including the check for usercontrolSameGroupPolicy (see config file for more information).
getTooltipAllPermissions()  : array<string|int, mixed>
Checks which permission entities (CRUD + import,export) a user has for the specific permission (e.g. permissionName='assessment'). Returns an array with infos.
getUserGroupNames()  : array<string|int, mixed>
Returns an array of user group names including 'usercontrolSameGroupPolicy' if set.
getUserIdsWithSurveyPermissions()  : array<string|int, mixed>
Get the userids which already have survey permissions.
getUserPermissionCriteria()  : CDbCriteria
Returns a CDbCriteria object which selects columns from table permissions and users taking care of samegrouppolicy and not logged in user for this survey.
getUsersSurveyPermissionEntity()  : Permission|null
Get the permissions (crud + import,export) for a survey permission like 'assessements'
getUsersSurveyPermissions()  : array<string|int, Permission>
Returns an array with data about users and their specific permissions for the survey. The returned array could be empty if there are no users with permissions for this survey.
getUsersSurveyPermissionsDataProvider()  : CActiveDataProvider
saveUserGroupPermissions()  : bool
Saves (inserts) permissions for a user group.
saveUserPermissions()  : bool
Saves (inserts ) the survey permissions for a specific user.

Properties

Methods

__construct()

SurveyPermissions constructor.

public __construct(Survey $survey, bool $userControlSameGroupPolicy) : mixed
Parameters
$survey : Survey
$userControlSameGroupPolicy : bool

addUserGroupToSurveyPermissions()

Adds users from a group to survey permissions.

public addUserGroupToSurveyPermissions(int $userGroupId) : int

This includes that the users get the permission 'read' for this survey.

Parameters
$userGroupId : int

the user group id

Return values
int

amount of users from the given group added

addUserToSurveyPermission()

Adds a user to the survey permissions. This includes that the user gets the permission 'read' for this survey.

public addUserToSurveyPermission(int $userid) : bool
Parameters
$userid : int

the userid

Return values
bool

true if user could be added, false otherwise

deleteUserPermissions()

Deletes all permissions for a user for this survey.

public deleteUserPermissions(int $userId) : int
Parameters
$userId : int
Return values
int

number of deleted permissions, 0 means nothing has been deleted

getSurveyUserGroupList()

Return a list (array) of user groups which could still be added to survey permissions.

public getSurveyUserGroupList() : array<string|int, mixed>

A user group could be added to survey permissions if there is at least one user in the group which has not already been added to survey permissions of this survey.

Return values
array<string|int, mixed>

containing ['ugid'] and ['name']

getSurveyUserList()

Returns a list of users which still not have survey permissions and could be added to survey permissions, including the check for usercontrolSameGroupPolicy (see config file for more information).

public getSurveyUserList() : array<string|int, mixed>
Return values
array<string|int, mixed>

getTooltipAllPermissions()

Checks which permission entities (CRUD + import,export) a user has for the specific permission (e.g. permissionName='assessment'). Returns an array with infos.

public getTooltipAllPermissions(int $userId, string $permissioName, array<string|int, mixed> $basicPermissionDetails) : array<string|int, mixed>
Parameters
$userId : int

the user id

$permissioName : string

permission name (e.g. 'assessments' or 'quotas')

$basicPermissionDetails : array<string|int, mixed>

array with basic information about a permission (e.g. permission name, single permissions(CRUD) etc.)

Return values
array<string|int, mixed>

structure is ['hasPermissions'] --> if user has at least one permission entity ['allPermissions'] --> does the user has ALL possible permission entities ['permissionCrudArray'] --> array with permission entities the user has

getUserGroupNames()

Returns an array of user group names including 'usercontrolSameGroupPolicy' if set.

public getUserGroupNames(int $userid, bool $usercontrolSameGroupPolicy) : array<string|int, mixed>
Parameters
$userid : int
$usercontrolSameGroupPolicy : bool
Return values
array<string|int, mixed>

names of user groups, or empty array

getUserIdsWithSurveyPermissions()

Get the userids which already have survey permissions.

public getUserIdsWithSurveyPermissions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getUserPermissionCriteria()

Returns a CDbCriteria object which selects columns from table permissions and users taking care of samegrouppolicy and not logged in user for this survey.

public getUserPermissionCriteria() : CDbCriteria
Return values
CDbCriteria

getUsersSurveyPermissionEntity()

Get the permissions (crud + import,export) for a survey permission like 'assessements'

public getUsersSurveyPermissionEntity(int $userid, string $permission) : Permission|null
Parameters
$userid : int

the userid

$permission : string

the survey permission (e.g. 'assessments', 'responses')

Return values
Permission|null

getUsersSurveyPermissions()

Returns an array with data about users and their specific permissions for the survey. The returned array could be empty if there are no users with permissions for this survey.

public getUsersSurveyPermissions() : array<string|int, Permission>
Return values
array<string|int, Permission>

getUsersSurveyPermissionsDataProvider()

public getUsersSurveyPermissionsDataProvider() : CActiveDataProvider
Return values
CActiveDataProvider

saveUserGroupPermissions()

Saves (inserts) permissions for a user group.

public saveUserGroupPermissions(int $userGroupId, array<string|int, mixed> $permissions) : bool
Parameters
$userGroupId : int
$permissions : array<string|int, mixed>
Tags
throws
Exception
Return values
bool

saveUserPermissions()

Saves (inserts ) the survey permissions for a specific user.

public saveUserPermissions(int $userId, array<string|int, mixed> $permissions) : bool
Parameters
$userId : int
$permissions : array<string|int, mixed>
Return values
bool

true if all permissions could be saved, false otherwise


        
On this page

Search results