Change Permissions |
Scroll |
When the TheSecurity class has loaded an object (e.g. a category, a document or a folder) you can view and modify the permissions that various users have on that object. These permissions are organized in ThePermissionList object. Each of these lists contains all permissions that one user has for the specified object.
The Step By Step guide and the code sample below show how to change permissions and save these changes on the server.
1 |
Connect to the Thereforeā¢ server (see "Server - Connect and Disconnect" for Details) |
2 |
Declare and initialize a new TheSecurity instance. |
3 |
Load permissions for an object. |
4 |
Get a list of Thereforeā¢ users from the server. |
5 |
Find the user whose permissions you want to modify. If you want to change the permissions for an Active Directory user who is not (yet) in Thereforeā¢ please refer to "Add Permissions for a New User". |
6 |
Get the ThePermissionList for the user. |
7 |
Find the ThePermission to change and set the Allowed/Denied value. Note: Setting the Allowed/Denied values throws an exception (access violation) if the value is inherited. The code sample checks for InheritAllowed and InheritDenied to avoid this situation. |
8 |
Save the changes on the server. |
Requirements and Assumptions: Category number 9 exists in your Thereforeā¢ system. User named "Test" is a valid Thereforeā¢ user. If these assumptions do not apply to your system or configuration please replace them with appropriate values when copying the code samples below. |