Posted By


errata on 03/09/12

Tagged


Statistics


Viewed 504 times
Favorited by 0 user(s)

ApplicationDelegate2


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. /**
  3. * A delegate class for the entire application to handle custom handling of
  4. * some functions such as permissions and preferences.
  5. */
  6. class conf_ApplicationDelegate {
  7. /**
  8. * Returns permissions array. This method is called every time an action is
  9. * performed to make sure that the user has permission to perform the action.
  10. * @param record A Dataface_Record object (may be null) against which we check
  11. * permissions.
  12. * @see Dataface_PermissionsTool
  13. * @see Dataface_AuthenticationTool
  14. */
  15. function getPermissions(&$record){
  16. $auth =& Dataface_AuthenticationTool::getInstance();
  17. $user =& $auth->getLoggedInUser();
  18. if ( !isset($user) ) return Dataface_PermissionsTool::NO_ACCESS();
  19. // if the user is null then nobody is logged in... no access.
  20. // This will force a login prompt.
  21. $role = $user->val('role');
  22. return Dataface_PermissionsTool::getRolePermissions($role);
  23. // Returns all of the permissions for the user's current role.
  24. }
  25. }
  26. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.