本文整理匯總了PHP中xPDO::hasPermission方法的典型用法代碼示例。如果您正苦於以下問題:PHP xPDO::hasPermission方法的具體用法?PHP xPDO::hasPermission怎麽用?PHP xPDO::hasPermission使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xPDO
的用法示例。
在下文中一共展示了xPDO::hasPermission方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getPermissions
/**
* Get a list of permissions for browsing and utilizing the source. May be overridden to provide a custom
* list of permissions.
* @return array
*/
public function getPermissions()
{
$this->permissions = array('directory_chmod' => $this->xpdo->hasPermission('directory_chmod'), 'directory_create' => $this->xpdo->hasPermission('directory_create'), 'directory_list' => $this->xpdo->hasPermission('directory_list'), 'directory_remove' => $this->xpdo->hasPermission('directory_remove'), 'directory_update' => $this->xpdo->hasPermission('directory_update'), 'file_list' => $this->xpdo->hasPermission('file_list'), 'file_remove' => $this->xpdo->hasPermission('file_remove'), 'file_update' => $this->xpdo->hasPermission('file_update'), 'file_upload' => $this->xpdo->hasPermission('file_upload'), 'file_view' => $this->xpdo->hasPermission('file_view'), 'file_create' => $this->xpdo->hasPermission('file_create'));
return $this->permissions;
}
示例2: canPostNew
/**
* Determines if the active user can post or not
*
* @param xPDO $modx A reference to the modX object
* @return bool
*/
public static function canPostNew(xPDO &$modx)
{
if ($modx->discuss->user->isAdmin()) {
return true;
}
return $modx->hasPermission('discuss.thread_create');
}