Tab visibility
Use the csApiSession
to check the against different roles which can be defined for the different tabs to control their visibility (New asset/ Asset from template / Asset from file).
Please mind that user roles are defined by the system administrators.
Backend:
- Command Handler path:
censhare-Client5/web/src/ng1/client/DAM/dialogs/csAssetCreateDialog
- Command Handler name:
com.censhare.api.dam.dialog.create.asset.config
- Command Handler public methods:
public OutputData execute(final CommandContext context)
- returns an ordered list of tabs
- Command Handler path:
Frontend:
- File localtion:
censhare-Client5/web/src/ng1/client/frames/csMainFrame/main-frame.directive.ts
function openAssetCreateDialog()
- calls thegetCreateAssetDialogContext()
function.- It retrieves the tabs from the
com.censhare.api.dam.dialog.create.asset.config
commandHandler and returns the dialog context. - Then it opens the
csAssetCreateDialog
from thecsAssetCreateDialogModule
.
- File localtion:
|
The response contains an array of the allowed tabs for the current user role:
|
Result
The return value of the dialog contains:
action
- the operation performed by the user: ‘new’, ‘new-template’, ‘add’, ‘upload’promise
- the promise returned by the executed command
|
Retrieving tabs
This is the process csAssetCreateDialog
follows to retrieve tabs, when the Create Asset action is triggered:
- function openAssetCreateDialog() is triggered which on its own turn calls the
getCreateAssetDialogContext()
function. getCreateAssetDialogContext()
retrieves the tabs from thecom.censhare.api.dam.dialog.create.asset.config
commandHandler and returns the dialog context.- Finally, the
csAssetCreateDialog
opens from thecsAssetCreateDialogModule
.
If no tabs are configured in the dialog for the current user, the following message will be displayed: Not possible to create a new asset: You have no permission to create new assets in this context.