Many times, it is not required for all users of a portal to be able to use your extension fully. In some cases, it is even important to provide restricted access to an extension's range of capabilities. We are now making it possible in Zoho Desk, through a new functionality called Custom Permissions.
Custom permissions are a new type of permission that you can provide in the extensions you develop. Using custom permissions, support admins/managers can configure different levels of access to your extension's functionalities, based on the user profiles set in their Zoho Desk portal.
Enabling Custom Permissions
- Open the resources.json file of your extension.
- Add the permissions to the json file, as shown below.
- {
- "permissions": [{
- "apiName": "createResolution",
- "displayName": "create Resolution",
- "description": "Able to create the Resolution task",
- "defaultState": true
- }, {
- "apiName": "editResolution",
- "displayName": "edit Resolution",
- "description": "Able to edit the Resolution task",
- "defaultState": false
- }, {
- "apiName": "deleteResolution",
- "displayName": "delete Resolution",
- "description": "Able to delete the Resolution task",
- "defaultState": false
- }]
- }
Configuring Custom Permissions
After an admin installs your extension, the custom permissions available are displayed under the PERMISSIONS tab on the extension detail page.
Fetching Details of Custom Permissions
You can fetch the custom permissions configured in an extension, using the following code block.
ZOHODESK.get('extension.permissions').then(function(permissions){
console.log(permissions)
}).catch(function(err){
console.log(err)
});
The response would be in the following format.
- {
- "status": "success",
- "extension.permissions": [
- {
- "apiName": "createResolution",
- "isEnabled": true
- },
- {
- "apiName": "editResolution",
- "isEnabled": false
- },
- {
- "apiName": "deleteResolution",
- "isEnabled": false
- }
- ]
- }