SurveyPermissions

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

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

package

Default

Methods

SurveyPermissions constructor.

__construct(\Survey $survey,boolean $userControlSameGroupPolicy)

Arguments

$survey

\Survey

$userControlSameGroupPolicy

boolean

Adds users from a group to survey permissions.

addUserGroupToSurveyPermissions(integer $userGroupId): integer

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

Arguments

$userGroupId

integer

the user group id

Response

integer

amount of users from the given group added

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

addUserToSurveyPermission(integer $userid): boolean

Arguments

$userid

integer

the userid

Response

boolean

true if user could be added, false otherwise

Deletes all permissions for a user for this survey.

deleteUserPermissions(integer $userId): integer

Arguments

$userId

integer

Response

integer

number of deleted permissions, 0 means nothing has been deleted

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

getSurveyUserGroupList(): array

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.

Response

array

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

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).

getSurveyUserList(): array

Response

array

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

getTooltipAllPermissions(integer $userId,string $permissioName,array $basicPermissionDetails): array

Arguments

$userId

integer

the user id

$permissioName

string

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

$basicPermissionDetails

array

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

Response

array

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

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

getUserGroupNames(integer $userid,boolean $usercontrolSameGroupPolicy): array

Arguments

$userid

integer

$usercontrolSameGroupPolicy

boolean

Response

array

names of user groups, or empty array

Get the userids which already have survey permissions.

getUserIdsWithSurveyPermissions(): array

Response

array

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

getUserPermissionCriteria(): \CDbCriteria

Response

\CDbCriteria

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

getUsersSurveyPermissionEntity(integer $userid,string $permission): \Permission|null

Arguments

$userid

integer

the userid

$permission

string

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

Response

\Permission|null

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.

getUsersSurveyPermissions(): array<mixed,\Permission>

Response

array<mixed,\Permission>

Saves (inserts) permissions for a user group.

saveUserGroupPermissions(integer $userGroupId,array $permissions): boolean
Throws
\Exception

Arguments

$userGroupId

integer

$permissions

array

Response

boolean

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

saveUserPermissions(integer $userId,array $permissions): boolean

Arguments

$userId

integer

$permissions

array

Response

boolean

true if all permissions could be saved, false otherwise

Properties

survey

survey :\Survey
var

Type(s)

\Survey

userControlSameGroupPolicy

userControlSameGroupPolicy :boolean
var

Type(s)

boolean