Availability
This plugin is available as of blojsom 2.28.
Description
Allows you to check permissions of a user of the blog in your templates. This would allow you to dynamically change the look and feel of your site, for example, adding or deleting menu options.
Installation and Setup
In your global /WEB-INF/plugin.properties file, add the following line:
permissions-check=org.blojsom.plugin.permission.PermissionCheckPlugin
You may then add "permissions-check" to the end one of the flavor-based plugin chains. These plugin chains can be found in the individual user's plugin.properties file. For example:
html.blojsom-plugin-chain=...,permissions-check
Usage and URL Parameters
There are no URL parameters to control the operation of the Permissions Check plugin.
Context Attributes and Types
The following table describes the context attributes that are available and their associated type.
| Context key |
Input or Output |
Type |
Description |
| BLOJSOM_PERMISSION_CHECKER |
Output |
org.blojsom.plugin.permission.PermissionChecker object |
You may use the public boolean checkPermission(String username, String permission) method to check permission for a given username and permission. |
Sample Usage
Here is a sample Velocity template snippet for using the permission checker object.
#if (!$BLOJSOM_PERMISSION_CHECKER.checkPermission("someuser", "bar"))
You do not have the bar permission!
#end