Message Boards
Permissions
Hi I have created one crud application and i want to give permissions for that like i have created 5 users and 5 roles and i have assigned roles to that 5 users and i want to implement in the code like if user1 login means where he can Add and view ,user2 logins means where he can update ,user3 logins means where he can delete , user4 login means where he can add view update and delete and if user5 login means where he can Add the form.
this thing i need to implement in my code?
RE: RE: Permissions
New Member Posts: 8 Join Date: 10/22/20 Recent PostsLike iam not gettuing exact how if user one login means add entry should come
RE: Permissions
Liferay Master Posts: 591 Join Date: 8/8/14 Recent PostsHi ,
You can make use of Liferay's Application Permission system for this , You can define 5 role and assign respected actions (ADD_ENTRY,DELETE,UPDATE,VIEW etc) for each role ,
Refer below links for implementation .
https://help.liferay.com/hc/en-us/articles/360017887012-Defining-Application-Permissions
https://help.liferay.com/hc/en-us/articles/360018166171-Defining-Resources-and-Permissions
https://help.liferay.com/hc/en-us/articles/360017887032-Registering-Permissions
https://help.liferay.com/hc/en-us/articles/360018166191-Associating-Permissions-with-Resources
https://help.liferay.com/hc/en-us/articles/360018166211-Checking-Permissions
https://help.liferay.com/hc/en-us/articles/360018166191-Associating-Permissions-with-Resources
RE: Permissions
Liferay Master Posts: 591 Join Date: 8/8/14 Recent PostsWhen you define action with respected permision then you can check using PermissionChecker Object whether the current user has requested action permission
Ex.
PermissionChecker permissionChecker = PermissionThreadLocal.getPermissionChecker();
permissionChecker.hasPermission(groupId, className, classPK, ActionKeys.ADD_ENTRY)
As in above example it will check whether the user is having
permission to add entry for given className and classPK