CanPerformOperation
mixed CSocNetFeaturesPerms::CanPerformOperation( int userID, char type, mixed id, string feature, string operation, bool bUserIsAdmin = false );
The method checks if current user can perform a specified operation with the indicated extra feature. For example, this method can check if the specified user can add entries into reports of an indicated workgroup. Static method.
Parameters
Parameter | Description | Available from version |
---|---|---|
userID | User ID, who's access permissions are checked. | |
type | Object type: SONET_ENTITY_GROUP - group, SONET_ENTITY_USER - user. |
|
id | Object ID (user or group), or (starting from version 8.6.4) - array of object IDs. | |
feature | Name of extra feature. | |
operation | Name of operation. | |
UserIsAdmin | Defines if the user is an administrator for a site or social network module. |
Returned value
When an ID parameter contains passed scalar value, the method returns true when a user has access permissions for the specified operation. Otherwise, the method returns false. When an array of object IDs is passed in the ID parameter (form version 8.6.4), an associative array is returned with object IDs as keys and values - true/false.
Standard extra features and its operations
- forum
- full - full access
- newtopic - create new topic
- answer - reply in the existing topic
- view - viewing
- photo - photo gallery
- write - full access
- view - viewing
- calendar
- write - full access
- view - viewing
- tasks
- view_all - view all tasks
- create_tasks - create new tasks
- delete_tasks - delete new tasks
- modify_folders - modify task folders
- files
- write - full access
- write_limited - write with limitations
- view - viewing
- blog- blogs
- view_post - view posts
- write_post - create posts
- full_post - full access
- view_comment - view comments
- write_comment - create comments
- full_comment - full access to comments
Example
<? if (CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_GROUP, $ID, "blog", "write_post")) { // Current user can write posts to the blog of the workgroup $ID } ?>
© «Bitrix24», 2001-2024