Returns the specified permission for the current user.
public static hasPermission ( string $permission ) : mixed | ||
$permission | string | A permission, currently only 'max_notes'. |
return | mixed | The value of the specified permission. |
/** * Returns an array of UIDs for all notes that the current user is authorized * to see. * * @param array|string $notepads The notepad(s) to list notes from. * * @return array An array of UIDs for all notes the user can access. * @throws Mnemo_Exception * @throws Horde_Exception_PermissionDenied */ public function listUids($notepads = null) { global $conf; if (!isset($conf['storage']['driver'])) { throw new RuntimeException('Not configured'); } // Make sure we have a valid notepad. if (empty($notepads)) { $notepads = Mnemo::getSyncNotepads(); } else { if (!is_array($notepads)) { $notepads = array($notepads); } foreach ($notepads as $notepad) { if (!Mnemo::hasPermission($notepad, Horde_Perms::READ)) { throw new Horde_Exception_PermissionDenied(); } } } // Set notepad for listMemos. $GLOBALS['display_notepads'] = $notepads; $memos = Mnemo::listMemos(); $uids = array(); foreach ($memos as $memo) { $uids[] = $memo['uid']; } return $uids; }