当前位置: 首页>>代码示例>>PHP>>正文


PHP GitRepository::belongsTo方法代码示例

本文整理汇总了PHP中GitRepository::belongsTo方法的典型用法代码示例。如果您正苦于以下问题:PHP GitRepository::belongsTo方法的具体用法?PHP GitRepository::belongsTo怎么用?PHP GitRepository::belongsTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GitRepository的用法示例。


在下文中一共展示了GitRepository::belongsTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GitRepository

 function permission_user_allowed_to_change($params)
 {
     if (!$params['allowed']) {
         if (!$this->_cached_permission_user_allowed_to_change) {
             if (in_array($params['permission_type'], array('PLUGIN_GIT_READ', 'PLUGIN_GIT_WRITE', 'PLUGIN_GIT_WPLUS'))) {
                 require_once 'GitRepository.class.php';
                 $repository = new GitRepository();
                 $repository->setId($params['object_id']);
                 try {
                     $repository->load();
                     //Only project admin can update perms of project repositories
                     //Only repo owner can update perms of personal repositories
                     $user = UserManager::instance()->getCurrentUser();
                     $this->_cached_permission_user_allowed_to_change = $repository->belongsTo($user) || $user->isMember($repository->getProjectId(), 'A');
                 } catch (Exception $e) {
                     // do nothing
                 }
             }
         }
         $params['allowed'] = $this->_cached_permission_user_allowed_to_change;
     }
 }
开发者ID:nterray,项目名称:tuleap,代码行数:22,代码来源:gitPlugin.class.php

示例2: testUserRepositoryDoesNotBelongToAnotherUser

 public function testUserRepositoryDoesNotBelongToAnotherUser()
 {
     $creator = new PFUser(array('language_id' => 1));
     $creator->setId(123);
     $user = new PFUser(array('language_id' => 1));
     $user->setId(456);
     $repo = new GitRepository();
     $repo->setCreator($creator);
     $repo->setScope(GitRepository::REPO_SCOPE_INDIVIDUAL);
     $this->assertFalse($repo->belongsTo($user));
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:11,代码来源:GitRepositoryTest.php

示例3: GitRepository

 function permission_user_allowed_to_change($params)
 {
     if (!$params['allowed']) {
         $user = $this->getCurrentUser();
         $project = $this->getProjectManager()->getProject($params['group_id']);
         if ($this->getGitPermissionsManager()->userIsGitAdmin($user, $project)) {
             $this->_cached_permission_user_allowed_to_change = true;
         }
         if (!$this->_cached_permission_user_allowed_to_change) {
             if (in_array($params['permission_type'], array('PLUGIN_GIT_READ', 'PLUGIN_GIT_WRITE', 'PLUGIN_GIT_WPLUS'))) {
                 $repository = new GitRepository();
                 $repository->setId($params['object_id']);
                 try {
                     $repository->load();
                     //Only project admin can update perms of project repositories
                     //Only repo owner can update perms of personal repositories
                     $this->_cached_permission_user_allowed_to_change = $repository->belongsTo($user) || $this->getPermissionsManager()->userIsGitAdmin($user, $project);
                 } catch (Exception $e) {
                     // do nothing
                 }
             }
         }
         $params['allowed'] = $this->_cached_permission_user_allowed_to_change;
     }
 }
开发者ID:LouisRenWeiWei,项目名称:tuleap,代码行数:25,代码来源:gitPlugin.class.php


注:本文中的GitRepository::belongsTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。