@@ -47,10 +47,9 @@ |
|
hasUserPermissions is the most important permissions checking method. You can use this to check any permission against a user. However, for three very common permissions, editing, viewing, and administrating, bitweaver has three convenience functions to make checking these easier. However, they are also very sophisticated, which is why recommend you use them in most cases of edit view and admin checking. See more on these below.
|
|
-{code}/* THIS FUNCTION DOES NOT EXIST YET - BUT WILL SOON */
|
-/* LibertyContent::verifyUserPermissions( $pPermName, $pVerifyAccessControl=TRUE, $pCheckGlobalPerm=TRUE ) */{/code}
|
+{code}LibertyContent::verifyUserPermissions( $pPermName, $pVerifyAccessControl=TRUE, $pCheckGlobalPerm=TRUE ){/code} |
|
-Although this function does not exist yet, it will soon, and when it does it will do the exact same thing has hasUserPermissions, however it will include an automatic failure so that you do not have to write any error handling on permissions invalidation. If you want to custom handle a failed permissions check, then you should use the hasUserPermissions method above which returns a boolean.
|
+This function does the exact same thing as hasUserPermissions, however it includes an automatic failure so that you do not have to write any error handling for a failed permissions check. If you want to custom handle a failed permissions check, then you should use the hasUserPermissions method above which returns a boolean. |
|
!!!Parameters
|
__PermName__ - the permission you want to know if the user has. example: p_blog_post
|
|
|
@@ -67,6 +66,15 @@ |
{code}LibertyContent::hasAdminPermission( $pVerifyAccessControl=TRUE ) {/code}
|
|
These three methods of LIberty Content are the prefered way of checking for these three basic permissions. Bitweaver's custom permissions sytem is rather sophisiticated, so it is highly recommended you use these functions. __To make use of these functions in your package you must also register your package permissions with these functions".
|
+ |
+There are also verify versions of these three methods which will automatically generate a fatal error page for you on invalidation. Again, as above, if you want to custom handle invalidation you should use the "has" methods above. |
+ |
+{code}LibertyContent::verifyEditPermission( $pVerifyAccessControl=TRUE ){/code} |
+ |
+{code}LibertyContent::verifyViewPermission( $pVerifyAccessControl=TRUE ){/code} |
+ |
+{code}LibertyContent::verifyAdminPermission( $pVerifyAccessControl=TRUE ) {/code} |
+ |
|
!!!Registering Permissions with Liberty
|
In your package constructor you can register edit, view, and admin permissions with the base LibertyContent class. Here is an example from BlogsPackage, file: BitBlog.php (The whole constructor is shown here, ''permissions registration is at the bottom''):
|
|
|