Question

Override getViewOptions after a check current user access!

I created an Operation Permission that will check if the user has limited access to the section and override the getViewOptions but the problem is getViewOptions was run first before the RightUtilities.checkCanExecuteOperation which checks the access of the user.



How can I able to check the user access and then override the getViewOptions?

getViewOptions: function () {
    var CanManageAccessRight = this.get("CanManageAccessRight");
 
    if (!CanManageAccessRight) {
        return this.Ext.create("Terrasoft.BaseViewModelCollection");
    } else {
        return this.callParent(arguments);
    }
}
checkCanManageAccessRight: function(callback) {
	RightUtilities.checkCanExecuteOperation({ operation: "CanManageAccessRight" }, function (result) {
		this.set("CanManageAccessRight", result);
	}, this);
}

 

Like 0

Like

1 comments

Hello,

 

You need to review which function is called before the getViewOptions method in the call stack in the developer console and use the operation permission in that method and only then call the getViewOptions method or not based on the result of the checkCanExecuteOperation method execution.

Show all comments