Ingo::hasSharePermission PHP Метод

hasSharePermission() публичный статический Метод

Check share permissions.
public static hasSharePermission ( $mask = null ) : boolean
Результат boolean True if user has permission.
    public static function hasSharePermission($mask = null)
    {
        global $injector, $registry, $session;
        return ($share = $injector->getInstance('Ingo_Shares')) ? $share->getShare($session->get('ingo', 'current_share'))->hasPermission($registry->getAuth(), $mask) : true;
    }

Usage Example

Пример #1
0
 /**
  * AJAX action: Re-sort the filters list.
  *
  * Variables used:
  *   - sort: (string) JSON serialized sort list of rule UIDs.
  *
  * @return boolean  True on success.
  */
 public function reSortFilters()
 {
     global $injector, $notification;
     if (!Ingo::hasSharePermission(Horde_Perms::EDIT)) {
         $notification->push(_("You do not have permission to edit filter rules."), 'horde.error');
         return false;
     }
     $storage = $injector->getInstance('Ingo_Factory_Storage')->create();
     try {
         $storage->sort(json_decode($this->vars->sort));
         $notification->push(_("Rule sort saved successfully."), 'horde.success');
     } catch (Ingo_Exception $e) {
         $notification->push(_("Rule sort not saved."), 'horde.error');
         return false;
     }
     try {
         $injector->getInstance('Ingo_Factory_Script')->activateAll();
     } catch (Ingo_Exception $e) {
         $notification->push($e, 'horde.warning');
     }
     return true;
 }
All Usage Examples Of Ingo::hasSharePermission