Beispiel #1
0
 /**
  * Checks if user has permission.
  *
  * @param   mixed    $permission Permission name string, perission Jam object, permission id
  * @return  boolean
  */
 public function model_call_has_permission(Jam_Model $user, Jam_Event_Data $data, $permission)
 {
     if ($permission instanceof Model_Permission) {
         $permission = $permission->name();
     } elseif (is_numeric($permission)) {
         $permission = Jam::factory('permission', $permission)->name();
     }
     if ($user->is_superadmin()) {
         $data->return = TRUE;
         $data->stop = TRUE;
     } else {
         $data->return = array_key_exists($permission, $user->permissions());
         $data->stop = TRUE;
     }
 }