本文整理汇总了PHP中PFUser::isMember方法的典型用法代码示例。如果您正苦于以下问题:PHP PFUser::isMember方法的具体用法?PHP PFUser::isMember怎么用?PHP PFUser::isMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PFUser
的用法示例。
在下文中一共展示了PFUser::isMember方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: userCanAdmin
/**
* Test is user can administrate FRS service of given project
*
* @param PFUser $user User to test
* @param Integer $groupId Project
*
* @return Boolean
*/
public static function userCanAdmin($user, $groupId)
{
return $user->isSuperUser() || $user->isMember($groupId, 'R2') || $user->isMember($groupId, 'A');
}
示例3: userIsRestrictedAndNotMemberOfProject
private function userIsRestrictedAndNotMemberOfProject(PFUser $user, Project $project)
{
return $user->isRestricted() && !$user->isMember($project->getID()) && $this->project_manager->checkRestrictedAccessForUser($project, $user);
}
示例4: restrictedMemberIsNotProjectMember
private function restrictedMemberIsNotProjectMember(PFUser $user, $project_id)
{
return $user->isRestricted() && !$user->isMember($project_id);
}
示例5: getUserProjectsAsOptions
public function getUserProjectsAsOptions(PFUser $user, ProjectManager $manager, $currentProjectId)
{
$purifier = Codendi_HTMLPurifier::instance();
$html = '';
$option = '<option value="%d" title="%s">%s</option>';
$usrProject = array_diff($user->getAllProjects(), array($currentProjectId));
foreach ($usrProject as $projectId) {
$project = $manager->getProject($projectId);
if ($user->isMember($projectId, 'A') && $project->usesService(GitPlugin::SERVICE_SHORTNAME)) {
$projectName = $project->getPublicName();
$projectUnixName = $purifier->purify($project->getUnixName());
$html .= sprintf($option, $projectId, $projectUnixName, $projectName);
}
}
return $html;
}
示例6: userIsRestrictedAndNotProjectMember
private function userIsRestrictedAndNotProjectMember(PFUser $user, Project $project)
{
return $project->allowsRestricted() && $user->isRestricted() && !$user->isMember($project->getID());
}
示例7: addGenericUserInProject
private function addGenericUserInProject(PFUser $user, $session_key, $group_id)
{
if (!$user->isMember($group_id)) {
$this->addProjectMember($session_key, $group_id, $user->getUnixName());
}
}
示例8: assertUserCanAccessProject
public function assertUserCanAccessProject(PFUser $user, Project $project)
{
if ($project->isPublic() && $user->isRestricted() && !$user->isMember($project->getGroupId()) || !$project->isPublic() && !$user->isMember($project->getGroupId())) {
throw new Exception('User do not have access to the project', '3002');
}
}
示例9: userCanWrite
/**
* Tests if the user is Superuser, or File release admin
*
* @param PFUser $user
* @param Integer $groupId
*
* @return Boolean
*/
function userCanWrite($user, $groupId)
{
// R2 refers to File release admin
return $this->isWriteEnabled() && ($user->isSuperUser() || $user->isMember($groupId, 'R2'));
}
示例10: userCanAdmin
/**
* Test if user can modify repository configuration
*
* @param PFUser $user The user to test
*
* @return Boolean
*/
public function userCanAdmin($user)
{
return $user->isMember($this->getProjectId(), 'A');
}
示例11: appendDynamicUGroups
/**
* Append project dynamic ugroups of user
*
* @param PFUser $user
* @param array $user_ugroups
*
* @return array the new array of user's ugroup
*/
private function appendDynamicUGroups(PFUser $user, array $user_ugroups = array())
{
$user_projects = $user->getProjects(true);
foreach ($user_projects as $user_project) {
$project_name = strtolower($user_project['unix_group_name']);
$group_id = $user_project['group_id'];
$user_ugroups[] = $this->ugroupIdToStringWithoutArobase(ProjectUGroup::PROJECT_MEMBERS, $project_name);
if ($user->isMember($group_id, 'A')) {
$user_ugroups[] = $this->ugroupIdToStringWithoutArobase(ProjectUGroup::PROJECT_ADMIN, $project_name);
}
}
return $user_ugroups;
}
示例12: removeMailByProjectPrivateRepository
/**
* Remove a notified mail address from all private repositories of a project
*
* @param Integer $groupId Porject ID to remove its repositories notification
* @param PFUser $user User to exclude from notification
*
* @return void
*/
function removeMailByProjectPrivateRepository($groupId, $user)
{
if (!$user->isMember($groupId)) {
$gitDao = $this->_getGitDao();
$repositoryList = $gitDao->getProjectRepositoryList($groupId);
if ($repositoryList) {
foreach ($repositoryList as $row) {
$repository = $this->_getGitRepository();
$repository->setId($row['repository_id']);
$repository->load();
if (!$repository->userCanRead($user)) {
if (!$this->removeMailByRepository($repository, $user->getEmail())) {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_git', 'dao_error_remove_notification'));
}
}
}
}
}
}
示例13: userCanAccessProject
/**
* Ensure given user can access given project
*
* @param PFUser $user
* @param Project $project
* @return boolean
* @throws Project_AccessProjectNotFoundException
* @throws Project_AccessDeletedException
* @throws Project_AccessRestrictedException
* @throws Project_AccessPrivateException
*/
public function userCanAccessProject(PFUser $user, Project $project)
{
if ($project->isError()) {
throw new Project_AccessProjectNotFoundException();
} elseif ($user->isSuperUser()) {
return true;
} elseif (!$project->isActive()) {
throw new Project_AccessDeletedException($project);
} elseif ($user->isMember($project->getID())) {
return true;
} elseif ($user->isRestricted() && !$this->canRestrictedUserAccess($user, $project)) {
throw new Project_AccessRestrictedException();
} elseif ($project->isPublic()) {
return true;
} elseif ($this->userHasBeenDelegatedAccess($user)) {
return true;
}
throw new Project_AccessPrivateException();
}
示例14: userCanAccessProject
/**
* Ensure given user can access given project
*
* @param PFUser $user
* @param Project $project
* @return boolean
* @throws Project_AccessProjectNotFoundException
* @throws Project_AccessDeletedException
* @throws Project_AccessRestrictedException
* @throws Project_AccessPrivateException
*/
public function userCanAccessProject(PFUser $user, Project $project)
{
if ($project->isError()) {
throw new Project_AccessProjectNotFoundException();
} elseif ($user->isSuperUser()) {
return true;
} elseif (!$project->isActive()) {
throw new Project_AccessDeletedException($project);
} elseif ($user->isMember($project->getID())) {
return true;
} elseif ($this->getPermissionsOverriderManager()->doesOverriderAllowUserToAccessProject($user, $project)) {
return true;
} elseif ($user->isRestricted()) {
if (!$project->allowsRestricted() || !$this->restrictedUserCanAccessUrl($user, $this->getUrl(), $_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME'])) {
throw new Project_AccessRestrictedException();
}
return true;
} elseif ($project->isPublic()) {
return true;
} elseif ($this->userHasBeenDelegatedAccess($user)) {
return true;
}
throw new Project_AccessPrivateException();
}
示例15: 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());
}