Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4826

Disable the menu button for particular User

$
0
0

@Boo wrote:

I’m having the menu for “cancel claim”. This menu needs to access only for the “admin” and “workflow” role person not other role persons.

I have tried the below code to disable to make the disable, but it’s not working. still the menu is working for the other roles.

Core.Action({
    id: "Core:releaseTasks",
    icon: 'workflow_task_claim_cancel',
    invoke: function (context) {
        context.setProperties({
            pool: 'release',
            skipTitle: this.get('messages.skip.title'),
            skipMessage: this.get('messages.skip.message'),
            taskIsValidForAction: function (task) {
                var assignee = task.get('assigneeUserId'),
                    my = context.get('user'),
                    admin = my.roles.CoreAdministrator || my.roles.CoreWorkflowAdministrator;
                return assignee && (assignee === my.name || admin);
            },
            taskIsInvalidForAction: function (task) {
                var assignee = task.get('assigneeUserId'),
                    admin = context.get('user.roles.CoreAdministrator') || context.get('user.roles.CoreWorkflowAdministrator');
                return assignee && (!admin && assignee !== context.get('user').name);
            }
        });
        return Core.Action('Core:workflow:setPool', context);
    },
    isValid: 'areTasks && isAssigned && isOpenTask && (isMyTask || isWorkflowAdmin)'
});

I need the menu needs to work only for the CoreAdministrator and CoreWorkflowAdministrator, not other roles.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4826

Trending Articles