本文整理汇总了PHP中PFUser::hasPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP PFUser::hasPermission方法的具体用法?PHP PFUser::hasPermission怎么用?PHP PFUser::hasPermission使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PFUser
的用法示例。
在下文中一共展示了PFUser::hasPermission方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: userHasPermissionOnPlanning
public function userHasPermissionOnPlanning($planning_id, $group_id, PFUser $user, $permission)
{
return $user->isMember($group_id) && $user->hasPermission($permission, $planning_id, $group_id);
}
示例2: userCanRead
/**
* Test is user can read the content of this repository and metadata
*
* @param PFUser $user The user to test
* @param GitRepository $repository The repository to test
*
* @return Boolean
*/
public function userCanRead($user, $repository)
{
return $user->isMember($repository->getProjectId(), 'A') || $user->hasPermission(Git::PERM_READ, $repository->getId(), $repository->getProjectId()) || $user->hasPermission(Git::PERM_WRITE, $repository->getId(), $repository->getProjectId()) || $user->hasPermission(Git::PERM_WPLUS, $repository->getId(), $repository->getProjectId());
}