Liferay-Permission Checker
Checking permission in liferay is just a matter of calling a function .
This function , is given the groupId , the name of the class , the primary key of the class and the type of Action supported.
We have defined all this in the default.xml file under the resource-actions folder.
The above permissionChecker , simply passes on these parameters and checks it against the permissions given to the particular user . If the user has permission it will return true , else false.
We have used the permission checker to toggle the Delete functionality for different users . Any user having role for which delete functionality has been granted permission . will see the delete icon , else wont.
Here is a screen shot displaying the permissionChecker in action , with 2 images of the portlet on before log-in and one after log-in.
Pre-Login .
Post-Login .
PermissionChecker API
Liferay Messages
SessionMessages and SessionErrors , are two classes which ease out sending out messages to the users or while debugging.
Few Uses of the liferay-error :
The message attribute contains the key to the key-value pair store in the Language.properties file.
Language.properties :
book-added=Books have been Added Successfully !
error-while-adding=Some Error has Occured While Adding, Please Try Again
If you click on Submit with all the fields empty , it will show you the above messages.
Cheers...!!
Gaurav Rastogi
No comments:
Post a Comment