Getting permissions by defined Role
See original GitHub issueIs it possible to get the array of permissions from a defined role? After login I’ve only got access to the role name from the authenticated user. (developer, seo, accountant, …)
var permissions = [
// dashboard
"dashboard",
// catalog
"product-list",
"product-edit",
"stock-list",
"category-list",
"manufacturer-list",
"manufacturer-edit",
"producttype-list",
"producttype-edit",
"specification-list",
"specification-edit",
// sales
"invoice-list",
"invoice-edit",
"order-list",
"order-edit",
"quote-list",
"quote-edit",
// customers
"customer-list",
"customer-edit",
// tools
"seo-edit",
"sync-list",
// warehouse
"warehouse-location-list",
"warehouse-stock-report"
];
PermissionStore.defineManyPermissions(permissions, function (permissionName, transitionProperties) {
return authService.checkUserPermissions(permissionName);
});
RoleStore.defineRole("developer", function() { return true; });
RoleStore.defineRole("seo", ["dashboard", "seo-list"]);
RoleStore.defineRole("accountant", ["dashboard", "customer-list", "customer-edit"]);
function checkUserPermissions(permissionName) {
if (auth.isAuthenticated) {
if (common.isNotEmpty(auth.profile)) {
var roles = _.toArray(auth.profile.roles);
var permissions = [];
roles.forEach(function(role) {
// GET THE PERMISSONS FOR THIS ROLE
});
return _.contains(permissions, permissionName);
}
}
return false;
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
Top Results From Across the Web
Role-based permissions overview - N-able
The access is the permission the user has to perform work. Roles define the job based on the requirements of the position. With...
Read more >Defining Role Permissions - Liferay Help Center
Defining Role Permissions · Go to the Control Panel and then click on Users → Roles. · On the Regular Roles screen, click...
Read more >What is the difference between a role and a permission?
Here are the system defined roles: Super Admin: User has all system permissions. Admin: User has all system permissions except the ability to...
Read more >Creating and managing custom roles - IAM - Google Cloud
Use the gcloud iam list-testable-permissions command to get a list of permissions that are available for custom roles in a specific project or...
Read more >Managing Roles and Permissions - FIWARE Tutorials
To grant an organization access to an application, click on the appliation to get to the details page and scroll to the bottom...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
When updating to version 5.1.0 this solutions is broken. Could this be resolved? I was updating from version 4.0.4 to 5.1.0
Nothing was no changes made in this method @Nesse…