Kronolith::listShareUsers PHP Метод

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

Returns a list of user with read access to a share.
public static listShareUsers ( Horde_Share_Object $share ) : array
$share Horde_Share_Object A share object.
Результат array A hash of share users.
    public static function listShareUsers($share)
    {
        global $injector;
        $users = $share->listUsers(Horde_Perms::READ);
        $groups = $share->listGroups(Horde_Perms::READ);
        if (count($groups)) {
            $horde_group = $injector->getInstance('Horde_Group');
            foreach ($groups as $group) {
                $users = array_merge($users, $horde_group->listUsers($group));
            }
        }
        $users = array_flip($users);
        $factory = $injector->getInstance('Horde_Core_Factory_Identity');
        foreach (array_keys($users) as $user) {
            $fullname = $factory->create($user)->getValue('fullname');
            $users[$user] = strlen($fullname) ? $fullname : $user;
        }
        return $users;
    }

Usage Example

Пример #1
0
 /**
  * Returns a hash representing this calendar.
  *
  * @return array  A simple hash.
  */
 public function toHash()
 {
     global $calendar_manager, $conf, $injector, $registry;
     $owner = $registry->getAuth() && $this->_share->get('owner') == $registry->getAuth();
     $hash = parent::toHash();
     $hash['name'] = Kronolith::getLabel($this->_share);
     $hash['desc'] = (string) $this->_share->get('desc');
     $hash['owner'] = $owner;
     $hash['users'] = Kronolith::listShareUsers($this->_share);
     $hash['fg'] = Kronolith::foregroundColor($this->_share);
     $hash['bg'] = Kronolith::backgroundColor($this->_share);
     $hash['show'] = in_array('tasks/' . $this->_share->getName(), $calendar_manager->get(Kronolith::DISPLAY_EXTERNAL_CALENDARS));
     $hash['edit'] = $this->_share->hasPermission($registry->getAuth(), Horde_Perms::EDIT);
     $hash['caldav'] = $this->caldavUrl();
     $hash['sub'] = Horde::url($registry->get('webroot', 'horde') . ($conf['urls']['pretty'] == 'rewrite' ? '/rpc/nag/' : '/rpc.php/nag/'), true, -1) . ($this->_share->get('owner') ? $registry->convertUsername($this->_share->get('owner'), false) : '-system-') . '/' . $this->_share->getName() . '.ics';
     if ($owner) {
         $hash['perms'] = Kronolith::permissionToJson($this->_share->getPermission(), is_null($this->_share->get('owner')));
     }
     return $hash;
 }
All Usage Examples Of Kronolith::listShareUsers