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


Java CurrentUser类代码示例

本文整理汇总了Java中com.google.gerrit.server.CurrentUser的典型用法代码示例。如果您正苦于以下问题:Java CurrentUser类的具体用法?Java CurrentUser怎么用?Java CurrentUser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CurrentUser类属于com.google.gerrit.server包,在下文中一共展示了CurrentUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldReplicate

import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
private boolean shouldReplicate(ProjectState projectState, CurrentUser user)
    throws PermissionBackendException {
  if (!config.replicateHiddenProjects()
      && projectState.getProject().getState()
          == com.google.gerrit.extensions.client.ProjectState.HIDDEN) {
    return false;
  }
  try {
    permissionBackend
        .user(user)
        .project(projectState.getNameKey())
        .check(ProjectPermission.ACCESS);
    return true;
  } catch (AuthException e) {
    return false;
  }
}
 
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:18,代码来源:Destination.java

示例2: parseIdOnBehalfOf

import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
private IdentifiedUser parseIdOnBehalfOf(@Nullable CurrentUser caller, String id)
    throws AuthException, OrmException, IOException, ConfigInvalidException {
  if (id.equals("self")) {
    CurrentUser user = self.get();
    if (user.isIdentifiedUser()) {
      return user.asIdentifiedUser();
    } else if (user instanceof AnonymousUser) {
      throw new AuthException("Authentication required");
    } else {
      return null;
    }
  }

  Account match = resolver.find(id);
  if (match == null) {
    return null;
  }
  CurrentUser realUser = caller != null ? caller.getRealUser() : null;
  return userFactory.runAs(null, match.getId(), realUser);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:21,代码来源:AccountsCollection.java

示例3: PostGpgKeys

import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
PostGpgKeys(
    @GerritPersonIdent Provider<PersonIdent> serverIdent,
    Provider<CurrentUser> self,
    Provider<PublicKeyStore> storeProvider,
    GerritPublicKeyChecker.Factory checkerFactory,
    AddKeySender.Factory addKeyFactory,
    Provider<InternalAccountQuery> accountQueryProvider,
    ExternalIds externalIds,
    ExternalIdsUpdate.User externalIdsUpdateFactory) {
  this.serverIdent = serverIdent;
  this.self = self;
  this.storeProvider = storeProvider;
  this.checkerFactory = checkerFactory;
  this.addKeyFactory = addKeyFactory;
  this.accountQueryProvider = accountQueryProvider;
  this.externalIds = externalIds;
  this.externalIdsUpdateFactory = externalIdsUpdateFactory;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:20,代码来源:PostGpgKeys.java

示例4: ChangesCollection

import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
ChangesCollection(
    Provider<ReviewDb> db,
    Provider<CurrentUser> user,
    Provider<QueryChanges> queryFactory,
    DynamicMap<RestView<ChangeResource>> views,
    ChangeFinder changeFinder,
    CreateChange createChange,
    ChangeResource.Factory changeResourceFactory,
    PermissionBackend permissionBackend) {
  this.db = db;
  this.user = user;
  this.queryFactory = queryFactory;
  this.views = views;
  this.changeFinder = changeFinder;
  this.createChange = createChange;
  this.changeResourceFactory = changeResourceFactory;
  this.permissionBackend = permissionBackend;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:20,代码来源:ChangesCollection.java

示例5: initVelocityModel

import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
private PluginVelocityModel initVelocityModel(HttpServletRequest request) throws IOException {
  PluginVelocityModel model = modelProvider.get();
  GitHubLogin gitHubLogin = loginProvider.get(request);
  model.put("myself", gitHubLogin.getMyself());
  model.put("config", config);

  CurrentUser user = userProvider.get();
  if (user.isIdentifiedUser()) {
    model.put("user", user);
    model.put("hub", gitHubLogin.getHub());
    model.put("scopeCookie", gitHubLogin.getScopesKeyFromCookie(request));
  }

  for (Entry<String, String[]> reqPar : request.getParameterMap().entrySet()) {
    model.put(reqPar.getKey(), reqPar.getValue());
  }
  return model;
}
 
开发者ID:GerritCodeReview,项目名称:plugins_github,代码行数:19,代码来源:VelocityViewServlet.java

示例6: Upload

import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
Upload(
    Provider<CurrentUser> userProvider,
    VisibleRefFilter.Factory refFilterFactory,
    TransferConfig transferConfig,
    DynamicSet<UploadPackInitializer> uploadPackInitializers,
    DynamicSet<PreUploadHook> preUploadHooks,
    UploadValidators.Factory uploadValidatorsFactory,
    ThreadLocalRequestContext threadContext,
    ProjectCache projectCache,
    PermissionBackend permissionBackend) {
  this.userProvider = userProvider;
  this.refFilterFactory = refFilterFactory;
  this.transferConfig = transferConfig;
  this.uploadPackInitializers = uploadPackInitializers;
  this.preUploadHooks = preUploadHooks;
  this.uploadValidatorsFactory = uploadValidatorsFactory;
  this.threadContext = threadContext;
  this.projectCache = projectCache;
  this.permissionBackend = permissionBackend;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:22,代码来源:InProcessProtocol.java

示例7: Receive

import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
Receive(
    Provider<CurrentUser> userProvider,
    ProjectCache projectCache,
    AsyncReceiveCommits.Factory factory,
    TransferConfig config,
    DynamicSet<ReceivePackInitializer> receivePackInitializers,
    DynamicSet<PostReceiveHook> postReceiveHooks,
    ThreadLocalRequestContext threadContext,
    PermissionBackend permissionBackend) {
  this.userProvider = userProvider;
  this.projectCache = projectCache;
  this.factory = factory;
  this.config = config;
  this.receivePackInitializers = receivePackInitializers;
  this.postReceiveHooks = postReceiveHooks;
  this.threadContext = threadContext;
  this.permissionBackend = permissionBackend;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:20,代码来源:InProcessProtocol.java

示例8: setUp

import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  Injector injector = Guice.createInjector(new InMemoryModule());
  injector.injectMembers(this);
  lifecycle = new LifecycleManager();
  lifecycle.add(injector);
  lifecycle.start();

  db = schemaFactory.open();
  schemaCreator.create(db);
  // Need to create at least one user to be admin before creating a "normal"
  // registered user.
  // See AccountManager#create().
  accountManager.authenticate(AuthRequest.forUser("admin")).getAccountId();
  admins = groupCache.get(new AccountGroup.NameKey("Administrators")).orElse(null).getGroupUUID();
  setUpPermissions();

  Account.Id userId = accountManager.authenticate(AuthRequest.forUser("user")).getAccountId();
  user = userFactory.create(userId);

  Project.NameKey name = new Project.NameKey("project");
  InMemoryRepository inMemoryRepo = repoManager.createRepository(name);
  project = new ProjectConfig(name);
  project.load(inMemoryRepo);
  repo = new TestRepository<>(inMemoryRepo);

  requestContext.setContext(
      new RequestContext() {
        @Override
        public CurrentUser getUser() {
          return user;
        }

        @Override
        public Provider<ReviewDb> getReviewDbProvider() {
          return Providers.of(db);
        }
      });
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:40,代码来源:CommitsCollectionTest.java

示例9: GetAccess

import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
public GetAccess(
    Provider<CurrentUser> self,
    PermissionBackend permissionBackend,
    GroupControl.Factory groupControlFactory,
    AllProjectsName allProjectsName,
    ProjectCache projectCache,
    MetaDataUpdate.Server metaDataUpdateFactory,
    ProjectJson projectJson,
    GroupBackend groupBackend,
    GroupJson groupJson) {
  this.user = self;
  this.permissionBackend = permissionBackend;
  this.groupControlFactory = groupControlFactory;
  this.allProjectsName = allProjectsName;
  this.projectJson = projectJson;
  this.projectCache = projectCache;
  this.metaDataUpdateFactory = metaDataUpdateFactory;
  this.groupBackend = groupBackend;
  this.groupJson = groupJson;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:22,代码来源:GetAccess.java

示例10: ActionJson

import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
ActionJson(
    Revisions revisions,
    ChangeJson.Factory changeJsonFactory,
    ChangeResource.Factory changeResourceFactory,
    UiActions uiActions,
    DynamicMap<RestView<ChangeResource>> changeViews,
    DynamicSet<ActionVisitor> visitorSet,
    Provider<CurrentUser> userProvider) {
  this.revisions = revisions;
  this.changeJsonFactory = changeJsonFactory;
  this.changeResourceFactory = changeResourceFactory;
  this.uiActions = uiActions;
  this.changeViews = changeViews;
  this.visitorSet = visitorSet;
  this.userProvider = userProvider;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:18,代码来源:ActionJson.java

示例11: ChangeResource

import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
ChangeResource(
    Provider<ReviewDb> db,
    AccountCache accountCache,
    ApprovalsUtil approvalUtil,
    PatchSetUtil patchSetUtil,
    PermissionBackend permissionBackend,
    StarredChangesUtil starredChangesUtil,
    ProjectCache projectCache,
    @Assisted ChangeNotes notes,
    @Assisted CurrentUser user) {
  this.db = db;
  this.accountCache = accountCache;
  this.approvalUtil = approvalUtil;
  this.patchSetUtil = patchSetUtil;
  this.permissionBackend = permissionBackend;
  this.starredChangesUtil = starredChangesUtil;
  this.projectCache = projectCache;
  this.notes = notes;
  this.user = user;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:22,代码来源:ChangeResource.java

示例12: VisibleRefFilter

import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
VisibleRefFilter(
    TagCache tagCache,
    ChangeNotes.Factory changeNotesFactory,
    @Nullable SearchingChangeCacheImpl changeCache,
    Provider<ReviewDb> db,
    Provider<CurrentUser> user,
    PermissionBackend permissionBackend,
    @Assisted ProjectState projectState,
    @Assisted Repository git) {
  this.tagCache = tagCache;
  this.changeNotesFactory = changeNotesFactory;
  this.changeCache = changeCache;
  this.db = db;
  this.user = user;
  this.permissionBackend = permissionBackend;
  this.perm =
      permissionBackend.user(user).database(db).project(projectState.getProject().getNameKey());
  this.projectState = projectState;
  this.git = git;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:22,代码来源:VisibleRefFilter.java

示例13: getLabelTypes

import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
/** All available label types for this branch and user. */
public LabelTypes getLabelTypes(Branch.NameKey destination, CurrentUser user) {
  List<LabelType> all = getLabelTypes().getLabelTypes();

  List<LabelType> r = Lists.newArrayListWithCapacity(all.size());
  for (LabelType l : all) {
    List<String> refs = l.getRefPatterns();
    if (refs == null) {
      r.add(l);
    } else {
      for (String refPattern : refs) {
        if (RefConfigSection.isValid(refPattern) && match(destination, refPattern, user)) {
          r.add(l);
          break;
        }
      }
    }
  }

  return new LabelTypes(r);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:22,代码来源:ProjectState.java

示例14: ProjectAccessFactory

import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
@Inject
ProjectAccessFactory(
    GroupBackend groupBackend,
    ProjectCache projectCache,
    PermissionBackend permissionBackend,
    Provider<CurrentUser> user,
    GroupControl.Factory groupControlFactory,
    MetaDataUpdate.Server metaDataUpdateFactory,
    AllProjectsName allProjectsName,
    WebLinks webLinks,
    @Assisted final Project.NameKey name) {
  this.groupBackend = groupBackend;
  this.projectCache = projectCache;
  this.permissionBackend = permissionBackend;
  this.user = user;
  this.groupControlFactory = groupControlFactory;
  this.metaDataUpdateFactory = metaDataUpdateFactory;
  this.allProjectsName = allProjectsName;
  this.webLinks = webLinks;

  this.projectName = name;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:23,代码来源:ProjectAccessFactory.java

示例15: batchAbandon

import com.google.gerrit.server.CurrentUser; //导入依赖的package包/类
public void batchAbandon(
    BatchUpdate.Factory updateFactory,
    Project.NameKey project,
    CurrentUser user,
    Collection<ChangeData> changes,
    String msgTxt)
    throws RestApiException, UpdateException {
  batchAbandon(
      updateFactory,
      project,
      user,
      changes,
      msgTxt,
      NotifyHandling.ALL,
      ImmutableListMultimap.of());
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:17,代码来源:Abandon.java


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