Permissions

register plugin permission

What is permissions?

In order for each plugin to be able to react to different signed in roles there's a permissions section. This means that you as an plugin developer can register named permissions which then can be mapped and later queried in your plugin in order to determine if the current user is of a specific role allowed to see/use a certain feature.

Example

Registering a plugin with permissions.

import DashboardPlugin from 'Dashboard/plugin'

const Plugin = new DashboardPlugin('@plugin_bundle')

const registerPlugin = () => {
    const { Application } = require('@components/Application')
    
    Plugin.register({
        application: Application,

        permissionKeys: [
            {
                id: 'PERMISSION_TO_CREATE_ID',
                label: 'Create stuff',
                description: 'a description describing what this does'
            },
            {
                id: 'PERMISSION_TO_UPDATE_ID',
                label: 'Update stuff',
                description: 'a description describing what this does'
            }
        ]
    })
}

registerPlugin()

export {
    Plugin
}

After a permission has been registered you'll then find a mapping section under plugin settings > permissions

Dashboard has four pre-defined roles, Admin, Power user, User and Readonly. Each authenticated user will get mapped into a specific role, which will allow a user of the plugin to configure which user who will get access to a specific function within the plugin. By default all permissions are empty which mean no one has permission to use the locked down feature.

Get mapped roles

In your plugin you'll be able to see the current user has the specific role thats mapped to the permission. This in order for you to either allow/disallow that the function is called or even if a component should be rendered at all.

Example

Determine if current user has permissions

pagehasPermission

Last updated