本文整理汇总了PHP中PermissionsManager::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP PermissionsManager::instance方法的具体用法?PHP PermissionsManager::instance怎么用?PHP PermissionsManager::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PermissionsManager
的用法示例。
在下文中一共展示了PermissionsManager::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPermissionsManager
private function getPermissionsManager()
{
if (empty($this->permission_manager)) {
$this->permission_manager = PermissionsManager::instance();
}
return $this->permission_manager;
}
示例2: getUgroupIdsPermissions
private function getUgroupIdsPermissions(Docman_Item $item, UGroupLiteralizer $literalizer, Project $project)
{
$ugroups_ids = $literalizer->getUgroupIds($project, $item->getId(), self::PERMISSIONS_TYPE);
if (empty($ugroups_ids)) {
$ugroups_ids = PermissionsManager::instance()->getAuthorizedUgroupIds($project->getID(), 'PLUGIN_DOCMAN_ADMIN');
}
$parent_item = $this->getParentItem($item, $project);
if ($parent_item) {
$parent_ugroups_ids = $this->getUgroupIdsPermissions($parent_item, $literalizer, $project);
$ugroups_ids = $this->mergeUgroupIds($parent_ugroups_ids, $ugroups_ids);
}
return array_values($ugroups_ids);
}
示例3: setUp
public function setUp()
{
parent::setUp();
$this->project_id++;
$this->repository_id++;
$this->project = new MockProject();
$this->project->setReturnValue('getId', $this->project_id);
$this->project->setReturnValue('getUnixName', 'project' . $this->project_id);
$this->repository = new MockGitRepository();
$this->repository->setReturnValue('getId', $this->repository);
stub($this->repository)->getProject()->returns($this->project);
PermissionsManager::setInstance(new MockPermissionsManager());
$this->permissions_manager = PermissionsManager::instance();
$this->serializer = new Git_Gitolite_ConfigPermissionsSerializer(stub('Git_Mirror_MirrorDataMapper')->fetchAllRepositoryMirrors()->returns(array()), 'whatever');
}
示例4: setUp
public function setUp()
{
parent::setUp();
$this->_fixDir = dirname(__FILE__) . '/_fixtures';
$GLOBALS['sys_https_host'] = 'localhost';
PermissionsManager::setInstance(mock('PermissionsManager'));
$this->permissions_manager = PermissionsManager::instance();
$this->repository_factory = mock('GitRepositoryFactory');
$git_plugin = stub('GitPlugin')->areFriendlyUrlsActivated()->returns(false);
$this->url_manager = new Git_GitRepositoryUrlManager($git_plugin);
$mirror_data_mapper = mock('Git_Mirror_MirrorDataMapper');
stub($mirror_data_mapper)->fetchAllRepositoryMirrors()->returns(array());
stub($mirror_data_mapper)->fetchAll()->returns(array());
$this->gitolite_permissions_serializer = new Git_Gitolite_ConfigPermissionsSerializer($mirror_data_mapper, 'whatever');
$this->logger = mock('Logger');
$this->project_serializer = new Git_Gitolite_ProjectSerializer($this->logger, $this->repository_factory, $this->gitolite_permissions_serializer, $this->url_manager);
}
示例5: setUp
public function setUp()
{
parent::setUp();
$this->cwd = getcwd();
$this->_fixDir = dirname(__FILE__) . '/_fixtures';
$tmpDir = $this->getTmpDir();
$this->_glAdmDirRef = $tmpDir . '/gitolite-admin-ref';
$this->sys_data_dir = $tmpDir;
$this->_glAdmDir = $tmpDir . '/gitolite/admin';
$this->repoDir = $tmpDir . '/repositories';
// Copy the reference to save time & create symlink because
// git is very sensitive to path you are using. Just symlinking
// spots bugs
mkdir($tmpDir . '/gitolite');
system('tar -xf ' . $this->_fixDir . '/gitolite-admin-ref' . '.tar --directory ' . $tmpDir);
symlink($this->_glAdmDirRef, $this->_glAdmDir);
mkdir($this->repoDir);
$GLOBALS['sys_https_host'] = 'localhost';
$GLOBALS['sys_data_dir'] = $this->sys_data_dir;
PermissionsManager::setInstance(new MockPermissionsManager());
$this->permissions_manager = PermissionsManager::instance();
$this->gitExec = partial_mock('Git_Exec', array('push'), array($this->_glAdmDir));
stub($this->gitExec)->push()->returns(true);
$this->user_manager = mock('UserManager');
$this->dumper = new Git_Gitolite_SSHKeyDumper($this->_glAdmDir, $this->gitExec);
$this->repository_factory = mock('GitRepositoryFactory');
$git_plugin = stub('GitPlugin')->areFriendlyUrlsActivated()->returns(false);
$this->url_manager = new Git_GitRepositoryUrlManager($git_plugin);
$this->mirror_data_mapper = mock('Git_Mirror_MirrorDataMapper');
stub($this->mirror_data_mapper)->fetchAllRepositoryMirrors()->returns(array());
stub($this->mirror_data_mapper)->fetchAll()->returns(array());
$this->gitolite_permissions_serializer = new Git_Gitolite_ConfigPermissionsSerializer($this->mirror_data_mapper, mock('Git_Driver_Gerrit_ProjectCreatorStatus'), 'whatever');
$this->git_system_event_manager = mock('Git_SystemEventManager');
$this->logger = mock('Logger');
$this->driver = new Git_GitoliteDriver($this->logger, $this->git_system_event_manager, $this->url_manager, mock('GitDao'), mock('Git_Mirror_MirrorDao'), mock('GitPlugin'), $this->gitExec, $this->repository_factory, $this->gitolite_permissions_serializer, null, null, $this->mirror_data_mapper);
}
示例6: addPermissions
/**
* Adds permissions in the database
*
* @param Array $ugroups the list of ugroups
* @param int $artifact The id of the artifact
*
* @return boolean
*/
public function addPermissions($ugroups, $artifact_id)
{
$pm = PermissionsManager::instance();
$permission_type = 'PLUGIN_TRACKER_ARTIFACT_ACCESS';
foreach ($ugroups as $ugroup) {
if (!$pm->addPermission($permission_type, $artifact_id, $ugroup)) {
return false;
}
}
return true;
}
示例7: getPermissionsManager
/**
* Wrapper for PermissionsManager
*
* @return PermissionsManager
*/
public function getPermissionsManager()
{
return PermissionsManager::instance();
}
示例8: getPermissionsManager
protected function getPermissionsManager()
{
return PermissionsManager::instance();
}
示例9: getPermissionsManager
private function getPermissionsManager()
{
return new Tuleap\ProFTPd\Admin\PermissionsManager(PermissionsManager::instance(), new UGroupManager());
}
示例10: getPermissionsManager
/**
* Returns a PermissionsManager instance
*
* @return PermissionsManager
*/
function getPermissionsManager()
{
$pm =& PermissionsManager::instance();
return $pm;
}
示例11: ugroupsCanSubmit
/**
* return true if users in ugroups have Submit permission on this field
*
* @param array $ugroups the ugroups users are part of
*
* @return bool
*/
protected function ugroupsCanSubmit($ugroups)
{
$pm = PermissionsManager::instance();
$ok = $pm->userHasPermission($this->id, self::PERMISSION_SUBMIT, $ugroups);
return $ok;
}
示例12: getPermissionSetter
private function getPermissionSetter()
{
return new Tracker_Permission_PermissionSetter($this->tracker, plugin_tracker_permission_get_tracker_ugroups_permissions($this->tracker->getGroupId(), $this->tracker->getId()), PermissionsManager::instance());
}
示例13: routeGitSmartHTTP
private function routeGitSmartHTTP(Git_URL $url)
{
if (!$url->isSmartHTTP()) {
return;
}
$repository = $url->getRepository();
if (!$repository) {
return;
}
$logger = new WrapperLogger($this->logger, 'http');
$logger->debug('REQUEST_URI ' . $_SERVER['REQUEST_URI']);
$command_factory = new Git_HTTP_CommandFactory($this->factory, new User_LoginManager(EventManager::instance(), UserManager::instance(), new User_PasswordExpirationChecker(), PasswordHandlerFactory::getPasswordHandler()), PermissionsManager::instance(), new URLVerification(), $logger);
$http_wrapper = new Git_HTTP_Wrapper($logger);
$http_wrapper->stream($command_factory->getCommandForRepository($repository, $url));
exit;
}
示例14: getPermissionsManager
public function getPermissionsManager()
{
if (!$this->permissionsManager) {
$this->permissionsManager = PermissionsManager::instance();
}
return $this->permissionsManager;
}
示例15:
function &_getPermissionsManagerInstance()
{
if (!$this->permissions_manager) {
$this->permissions_manager =& PermissionsManager::instance();
}
return $this->permissions_manager;
}