Examples of CurrentUser


Examples of com.google.gerrit.server.CurrentUser

        }
        loadPublished(byKey, aic, newName);
        break;
    }

    final CurrentUser user = control.getCurrentUser();
    if (user instanceof IdentifiedUser) {
      final Account.Id me = ((IdentifiedUser) user).getAccountId();
      switch (changeType) {
        case ADDED:
        case MODIFIED:
View Full Code Here

Examples of com.google.gerrit.server.CurrentUser

    detail.setPatchSet(patchSet);

    detail.setInfo(infoFactory.get(db, psIdNew));
    detail.setPatches(patches);

    final CurrentUser user = control.getCurrentUser();
    if (user instanceof IdentifiedUser) {
      // If we are signed in, compute the number of draft comments by the
      // current user on each of these patch files. This way they can more
      // quickly locate where they have pending drafts, and review them.
      //
View Full Code Here

Examples of com.google.gerrit.server.CurrentUser

    if (!handles(uuid)) {
      return null;
    }

    String groupDn = uuid.get().substring(LDAP_UUID.length());
    CurrentUser user = userProvider.get();
    if (!(user instanceof IdentifiedUser)
        || !membershipsOf((IdentifiedUser) user).contains(uuid)) {
      try {
        if (!existsCache.get(groupDn)) {
          return null;
View Full Code Here

Examples of com.google.gerrit.server.CurrentUser

  protected void doGet(final HttpServletRequest req,
      final HttpServletResponse rsp) throws IOException {
    final Page.Content page = get().get(select(req));
    final byte[] raw;

    final CurrentUser user = currentUser.get();
    if (user instanceof IdentifiedUser) {
      final StringWriter w = new StringWriter();
      w.write(HPD_ID + ".account=");
      json(((IdentifiedUser) user).getAccount(), w);
      w.write(";");
View Full Code Here

Examples of com.google.gerrit.server.CurrentUser

  public Operation exec(Prolog engine) throws PrologException {
    engine.setB0();
    Term a1 = arg1.dereference();

    ChangeControl cControl = StoredValues.CHANGE_CONTROL.get(engine);
    CurrentUser curUser = cControl.getCurrentUser();
    Term resultTerm;

    if (curUser instanceof IdentifiedUser) {
      Account.Id id = ((IdentifiedUser)curUser).getAccountId();
      resultTerm = new IntegerTerm(id.get());
View Full Code Here

Examples of com.google.gerrit.server.CurrentUser

  }

  private void checkRequiresCapability(Command cmd) throws UnloggedFailure {
    RequiresCapability rc = cmd.getClass().getAnnotation(RequiresCapability.class);
    if (rc != null) {
      CurrentUser user = currentUser.get();
      CapabilityControl ctl = user.getCapabilities();
      if (!ctl.canPerform(rc.value()) && !ctl.canAdministrateServer()) {
        String msg = String.format(
            "fatal: %s does not have \"%s\" capability.",
            user.getUserName(), rc.value());
        throw new UnloggedFailure(BaseCommand.STATUS_NOT_ADMIN, msg);
      }
    }
  }
View Full Code Here

Examples of com.google.gerrit.server.CurrentUser

  private String username(final SshSession sd) {
    if (sd == null) {
      return "";
    }

    final CurrentUser user = sd.getCurrentUser();
    if (user instanceof IdentifiedUser) {
      IdentifiedUser u = (IdentifiedUser) user;

      if (!numeric) {
        String name = u.getAccount().getUserName();
View Full Code Here

Examples of com.google.gerrit.server.CurrentUser

  }

  private void checkRequiresCapability() throws RequireCapabilityException {
    RequiresCapability rc = getClass().getAnnotation(RequiresCapability.class);
    if (rc != null) {
      CurrentUser user = currentUser.get();
      CapabilityControl ctl = user.getCapabilities();
      if (!ctl.canPerform(rc.value()) && !ctl.canAdministrateServer()) {
        String msg = String.format(
            "fatal: %s does not have \"%s\" capability.",
            Objects.firstNonNull(user.getUserName(),
                ((IdentifiedUser)user).getNameEmail()),
            rc.value());
        throw new RequireCapabilityException(msg);
      }
    }
View Full Code Here

Examples of com.google.gerrit.server.CurrentUser

      throw new PInstantiationException(this, 2);
    }
    if (!a2.isJavaObject() || !a2.convertible(CurrentUser.class)) {
      throw new IllegalTypeException(this, 2, "CurrentUser)", a2);
    }
    CurrentUser user = (CurrentUser) ((JavaObjectTerm) a2).object();

    ChangeControl ctl = StoredValues.CHANGE_CONTROL.get(engine).forUser(user);
    PermissionRange range = ctl.getRange(Permission.LABEL + label);
    if (range == null) {
      return engine.fail();
View Full Code Here

Examples of com.google.gerrit.server.CurrentUser

      return session;
    }

    @Override
    public CurrentUser getCurrentUser() {
      final CurrentUser user = session.getCurrentUser();
      if (user instanceof IdentifiedUser) {
        return userFactory.create(user.getAccessPath(), //
            ((IdentifiedUser) user).getAccountId());
      }
      return user;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.