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


Java IdentifiedUser类代码示例

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


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

示例1: CreateBatchUser

import com.google.gerrit.server.IdentifiedUser; //导入依赖的package包/类
@Inject
public CreateBatchUser(@PluginName String pluginName, SchemaFactory<ReviewDb> schema,
					   PluginConfigFactory configFactory, SshKeyCache sshKeyCache, VersionedAuthorizedKeys.Accessor authorizedKeys,
					   AccountCache accountCache, AccountByEmailCache byEmailCache, AccountLoader.Factory infoLoader,
					   GroupsCollection groupsCollection, WorkQueue queue, ThreadLocalRequestContext context,
					   IdentifiedUser.GenericFactory userFactory) {
	this.schema = schema;
	this.sshKeyCache = sshKeyCache;
	this.authorizedKeys = authorizedKeys;
	this.accountCache = accountCache;
	this.byEmailCache = byEmailCache;
	this.infoLoader = infoLoader;
	this.groupsCollection = groupsCollection;
	this.context = context;
	this.userFactory = userFactory;
	pluginConfig = configFactory.getFromGerritConfig(pluginName);
	username = pluginConfig.getString("username", "jenkins");
	sshKey = pluginConfig.getString("sshKey");
	name = pluginConfig.getString("name", "Batch user");
	executor = queue.getDefaultQueue();

	createBatchUserIfNotExistsYet();
}
 
开发者ID:atteo,项目名称:jfactory,代码行数:24,代码来源:CreateBatchUser.java

示例2: toJson

import com.google.gerrit.server.IdentifiedUser; //导入依赖的package包/类
private Map<String, GpgKeyInfo> toJson(
    Collection<PGPPublicKeyRing> keys,
    Set<Fingerprint> deleted,
    PublicKeyStore store,
    IdentifiedUser user)
    throws IOException {
  // Unlike when storing keys, include web-of-trust checks when producing
  // result JSON, so the user at least knows of any issues.
  PublicKeyChecker checker = checkerFactory.create(user, store);
  Map<String, GpgKeyInfo> infos = Maps.newHashMapWithExpectedSize(keys.size() + deleted.size());
  for (PGPPublicKeyRing keyRing : keys) {
    PGPPublicKey key = keyRing.getPublicKey();
    CheckResult result = checker.check(key);
    GpgKeyInfo info = GpgKeys.toJson(key, result);
    infos.put(info.id, info);
    info.id = null;
  }
  for (Fingerprint fp : deleted) {
    infos.put(keyIdToString(fp.getId()), new GpgKeyInfo());
  }
  return infos;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:23,代码来源:PostGpgKeys.java

示例3: apply

import com.google.gerrit.server.IdentifiedUser; //导入依赖的package包/类
public Response<String> apply(IdentifiedUser user, NameInput input)
    throws MethodNotAllowedException, ResourceNotFoundException, IOException,
        ConfigInvalidException {
  if (input == null) {
    input = new NameInput();
  }

  if (!realm.allowsEdit(AccountFieldName.FULL_NAME)) {
    throw new MethodNotAllowedException("realm does not allow editing name");
  }

  String newName = input.name;
  Account account =
      accountsUpdate.create().update(user.getAccountId(), a -> a.setFullName(newName));
  if (account == null) {
    throw new ResourceNotFoundException("account not found");
  }
  return Strings.isNullOrEmpty(account.getFullName())
      ? Response.none()
      : Response.ok(account.getFullName());
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:22,代码来源:PutName.java

示例4: ExternalIdsUpdate

import com.google.gerrit.server.IdentifiedUser; //导入依赖的package包/类
private ExternalIdsUpdate(
    GitRepositoryManager repoManager,
    @Nullable AccountCache accountCache,
    AllUsersName allUsersName,
    MetricMaker metricMaker,
    ExternalIds externalIds,
    ExternalIdCache externalIdCache,
    PersonIdent committerIdent,
    PersonIdent authorIdent,
    @Nullable IdentifiedUser currentUser,
    GitReferenceUpdated gitRefUpdated) {
  this(
      repoManager,
      accountCache,
      allUsersName,
      metricMaker,
      externalIds,
      externalIdCache,
      committerIdent,
      authorIdent,
      currentUser,
      gitRefUpdated,
      Runnables.doNothing(),
      RETRYER);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:26,代码来源:ExternalIdsUpdate.java

示例5: setAccountIdentity

import com.google.gerrit.server.IdentifiedUser; //导入依赖的package包/类
private void setAccountIdentity(IdentifiedUser user, HttpServletRequest req)
    throws ServletException, ConfigInvalidException {
  String fullName = req.getParameter("fullname");
  String email = req.getParameter("email");
  try {
    Id accountId = user.getAccountId();
    AuthResult result = accountManager.link(accountId, AuthRequest.forEmail(email));
    log.debug("Account {} linked to email {}: result = {}", accountId, email, result);

    putPreferred.apply(new AccountResource.Email(user, email), null);
    PutName.Input nameInput = new PutName.Input();
    nameInput.name = fullName;
    putName.apply(user, nameInput);
    log.debug(
        "Account {} updated with preferredEmail = {} and fullName = {}",
        accountId,
        email,
        fullName);

    accountCache.evict(accountId);
    log.debug("Account cache evicted for {}", accountId);
  } catch (Exception e) {
    throw new ServletException(
        "Cannot associate email '" + email + "' to current user '" + user + "'", e);
  }
}
 
开发者ID:GerritCodeReview,项目名称:plugins_github,代码行数:27,代码来源:AccountController.java

示例6: username

import com.google.gerrit.server.IdentifiedUser; //导入依赖的package包/类
private String username(SshSession sd) {
  if (sd == null) {
    return "";
  }

  final CurrentUser user = sd.getUser();
  if (user != null && user.isIdentifiedUser()) {
    IdentifiedUser u = user.asIdentifiedUser();

    if (!numeric) {
      String name = u.getAccount().getUserName();
      if (name != null && !name.isEmpty()) {
        return name;
      }
    }

    return "a/" + u.getAccountId().toString();
  }
  return "";
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:21,代码来源:ShowConnections.java

示例7: AccountsUpdate

import com.google.gerrit.server.IdentifiedUser; //导入依赖的package包/类
private AccountsUpdate(
    GitRepositoryManager repoManager,
    GitReferenceUpdated gitRefUpdated,
    @Nullable IdentifiedUser currentUser,
    AllUsersName allUsersName,
    OutgoingEmailValidator emailValidator,
    PersonIdent committerIdent,
    MetaDataUpdateFactory metaDataUpdateFactory) {
  this.repoManager = checkNotNull(repoManager, "repoManager");
  this.gitRefUpdated = checkNotNull(gitRefUpdated, "gitRefUpdated");
  this.currentUser = currentUser;
  this.allUsersName = checkNotNull(allUsersName, "allUsersName");
  this.emailValidator = checkNotNull(emailValidator, "emailValidator");
  this.committerIdent = checkNotNull(committerIdent, "committerIdent");
  this.metaDataUpdateFactory = checkNotNull(metaDataUpdateFactory, "metaDataUpdateFactory");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:17,代码来源:AccountsUpdate.java

示例8: format

import com.google.gerrit.server.IdentifiedUser; //导入依赖的package包/类
public AgreementInfo format(ContributorAgreement ca) {
  AgreementInfo info = new AgreementInfo();
  info.name = ca.getName();
  info.description = ca.getDescription();
  info.url = ca.getAgreementUrl();
  GroupReference autoVerifyGroup = ca.getAutoVerify();
  if (autoVerifyGroup != null && self.get().isIdentifiedUser()) {
    IdentifiedUser user = identifiedUserFactory.create(self.get().getAccountId());
    try {
      GroupControl gc = genericGroupControlFactory.controlFor(user, autoVerifyGroup.getUUID());
      GroupResource group = new GroupResource(gc);
      info.autoVerifyGroup = groupJson.format(group);
    } catch (NoSuchGroupException | OrmException e) {
      log.warn(
          "autoverify group \""
              + autoVerifyGroup.getName()
              + "\" does not exist, referenced in CLA \""
              + ca.getName()
              + "\"");
    }
  }
  return info;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:24,代码来源:AgreementJson.java

示例9: PullRequestCreateChange

import com.google.gerrit.server.IdentifiedUser; //导入依赖的package包/类
@Inject
PullRequestCreateChange(
    ChangeInserter.Factory changeInserterFactory,
    PatchSetInserter.Factory patchSetInserterFactory,
    ProjectControl.Factory projectControlFactory,
    IdentifiedUser.GenericFactory userFactory,
    Provider<InternalChangeQuery> queryProvider,
    BatchUpdate.Factory batchUpdateFactory,
    ChangeQueryProcessor qp,
    ChangeQueryBuilder changeQuery) {
  this.changeInserterFactory = changeInserterFactory;
  this.patchSetInserterFactory = patchSetInserterFactory;
  this.projectControlFactory = projectControlFactory;
  this.userFactory = userFactory;
  this.queryProvider = queryProvider;
  this.updateFactory = batchUpdateFactory;
  this.qp = qp;
  this.changeQuery = changeQuery;
}
 
开发者ID:GerritCodeReview,项目名称:plugins_github,代码行数:20,代码来源:PullRequestCreateChange.java

示例10: ListGroups

import com.google.gerrit.server.IdentifiedUser; //导入依赖的package包/类
@Inject
protected ListGroups(
    final GroupCache groupCache,
    final GroupControl.Factory groupControlFactory,
    final GroupControl.GenericFactory genericGroupControlFactory,
    final Provider<IdentifiedUser> identifiedUser,
    final IdentifiedUser.GenericFactory userFactory,
    final GetGroups accountGetGroups,
    final GroupsCollection groupsCollection,
    GroupJson json,
    GroupBackend groupBackend,
    Groups groups,
    Provider<ReviewDb> db) {
  this.groupCache = groupCache;
  this.groupControlFactory = groupControlFactory;
  this.genericGroupControlFactory = genericGroupControlFactory;
  this.identifiedUser = identifiedUser;
  this.userFactory = userFactory;
  this.accountGetGroups = accountGetGroups;
  this.json = json;
  this.groupBackend = groupBackend;
  this.groups = groups;
  this.groupsCollection = groupsCollection;
  this.db = db;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:26,代码来源:ListGroups.java

示例11: checkValidTrustChainAndCorrectExternalIds

import com.google.gerrit.server.IdentifiedUser; //导入依赖的package包/类
@Test
public void checkValidTrustChainAndCorrectExternalIds() throws Exception {
  // A---Bx
  //  \
  //   \---C---D
  //        \
  //         \---Ex
  //
  // The server ultimately trusts B and D.
  // D and E trust C to be a valid introducer of depth 2.
  IdentifiedUser userB = addUser("userB");
  TestKey keyA = add(keyA(), user);
  TestKey keyB = add(keyB(), userB);
  add(keyC(), addUser("userC"));
  add(keyD(), addUser("userD"));
  add(keyE(), addUser("userE"));

  // Checker for A, checking A.
  PublicKeyChecker checkerA = checkerFactory.create(user, store);
  assertNoProblems(checkerA.check(keyA.getPublicKey()));

  // Checker for B, checking B. Trust chain and IDs are correct, so the only
  // problem is with the key itself.
  PublicKeyChecker checkerB = checkerFactory.create(userB, store);
  assertProblems(checkerB.check(keyB.getPublicKey()), Status.BAD, "Key is expired");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:27,代码来源:GerritPublicKeyCheckerTest.java

示例12: SetAssigneeOp

import com.google.gerrit.server.IdentifiedUser; //导入依赖的package包/类
@Inject
SetAssigneeOp(
    ChangeMessagesUtil cmUtil,
    DynamicSet<AssigneeValidationListener> validationListeners,
    AssigneeChanged assigneeChanged,
    SetAssigneeSender.Factory setAssigneeSenderFactory,
    Provider<IdentifiedUser> user,
    IdentifiedUser.GenericFactory userFactory,
    @Assisted IdentifiedUser newAssignee) {
  this.cmUtil = cmUtil;
  this.validationListeners = validationListeners;
  this.assigneeChanged = assigneeChanged;
  this.setAssigneeSenderFactory = setAssigneeSenderFactory;
  this.user = user;
  this.userFactory = userFactory;
  this.newAssignee = checkNotNull(newAssignee, "assignee");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:18,代码来源:SetAssigneeOp.java

示例13: SetAccess

import com.google.gerrit.server.IdentifiedUser; //导入依赖的package包/类
@Inject
private SetAccess(
    GroupBackend groupBackend,
    PermissionBackend permissionBackend,
    Provider<MetaDataUpdate.User> metaDataUpdateFactory,
    ProjectCache projectCache,
    GetAccess getAccess,
    Provider<IdentifiedUser> identifiedUser,
    SetAccessUtil accessUtil,
    CreateGroupPermissionSyncer createGroupPermissionSyncer) {
  this.groupBackend = groupBackend;
  this.permissionBackend = permissionBackend;
  this.metaDataUpdateFactory = metaDataUpdateFactory;
  this.getAccess = getAccess;
  this.projectCache = projectCache;
  this.identifiedUser = identifiedUser;
  this.accessUtil = accessUtil;
  this.createGroupPermissionSyncer = createGroupPermissionSyncer;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:20,代码来源:SetAccess.java

示例14: User

import com.google.gerrit.server.IdentifiedUser; //导入依赖的package包/类
@Inject
public User(
    GitRepositoryManager repoManager,
    AccountCache accountCache,
    AllUsersName allUsersName,
    MetricMaker metricMaker,
    ExternalIds externalIds,
    ExternalIdCache externalIdCache,
    @GerritPersonIdent Provider<PersonIdent> serverIdent,
    Provider<IdentifiedUser> identifiedUser,
    GitReferenceUpdated gitRefUpdated) {
  this.repoManager = repoManager;
  this.accountCache = accountCache;
  this.allUsersName = allUsersName;
  this.metricMaker = metricMaker;
  this.externalIds = externalIds;
  this.externalIdCache = externalIdCache;
  this.serverIdent = serverIdent;
  this.identifiedUser = identifiedUser;
  this.gitRefUpdated = gitRefUpdated;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:22,代码来源:ExternalIdsUpdate.java

示例15: forGerritCommits

import com.google.gerrit.server.IdentifiedUser; //导入依赖的package包/类
public CommitValidators forGerritCommits(
    PermissionBackend.ForRef perm,
    Branch.NameKey branch,
    IdentifiedUser user,
    SshInfo sshInfo,
    RevWalk rw,
    ProjectState projectState)
    throws IOException {
  return new CommitValidators(
      ImmutableList.of(
          new UploadMergesPermissionValidator(perm),
          new AmendedGerritMergeCommitValidationListener(perm, gerritIdent),
          new AuthorUploaderValidator(user, perm, canonicalWebUrl),
          new SignedOffByValidator(user, perm, projectCache.checkedGet(branch.getParentKey())),
          new ChangeIdValidator(
              projectCache.checkedGet(branch.getParentKey()),
              user,
              canonicalWebUrl,
              installCommitMsgHookCommand,
              sshInfo),
          new ConfigValidator(branch, user, rw, allUsers, allProjects, projectState),
          new PluginCommitValidationListener(pluginValidators),
          new ExternalIdUpdateListener(allUsers, externalIdsConsistencyChecker),
          new AccountCommitValidator(allUsers, accountValidator),
          new GroupCommitValidator(allUsers)));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:27,代码来源:CommitValidators.java


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