Package com.google.gerrit.common.data

Examples of com.google.gerrit.common.data.PermissionRange


   */
  private void applyRightFloor(final ApprovalType at, final PatchSetApproval a) {
    final ApprovalCategory category = at.getCategory();
    final String permission = Permission.forLabel(category.getLabelName());
    final IdentifiedUser user = userFactory.create(a.getAccountId());
    final PermissionRange range = controlFor(user).getRange(permission);
    a.setValue((short) range.squash(a.getValue()));
  }
View Full Code Here


          for (SubmitRecord.Label lbl : rec.labels) {
            aic.want(lbl.appliedBy);

            boolean canMakeOk = false;
            PermissionRange range = rangeByName.get(lbl.label);
            if (range != null) {
              if (!allowed.contains(range)) {
                allowed.add(range);
              }

              ApprovalType at = approvalTypes.byLabel(lbl.label);
              if (at == null || at.getMax().getValue() == range.getMax()) {
                canMakeOk = true;
              }
            }

            switch (lbl.status) {
View Full Code Here

    int max = 0;
    for (PermissionRule rule : ruleList) {
      min = Math.min(min, rule.getMin());
      max = Math.max(max, rule.getMax());
    }
    return new PermissionRange(permissionName, min, max);
  }
View Full Code Here

      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();
    }

    IntegerTerm min = new IntegerTerm(range.getMin());
    IntegerTerm max = new IntegerTerm(range.getMax());

    if (!a3.unify(min, engine.trail)) {
      return engine.fail();
    }
View Full Code Here

    grant(local, LABEL + "Code-Review", -2, +2, devs, "refs/heads/*");
    grant(parent, LABEL + "Code-Review", -2, +2, devs, "refs/heads/*").setBlock();

    ProjectControl u = user(devs);

    PermissionRange range = u.controlForRef("refs/heads/master").getRange(LABEL + "Code-Review");
    assertTrue("u can vote -1", range.contains(-1));
    assertTrue("u can vote +1", range.contains(1));
    assertFalse("u can't vote -2", range.contains(-2));
    assertFalse("u can't vote 2", range.contains(2));
  }
View Full Code Here

            min = Math.min(min, rule.getMin());
            max = Math.max(max, rule.getMax());
          }
        }
        if (min != 0 || max != 0) {
          r.add(new PermissionRange(e.getKey(), min, max));
        }
      }
    }
    return r;
  }
View Full Code Here

      min = Math.max(min, blockMin + 1);
    }
    if (blockMax < Integer.MAX_VALUE) {
      max = Math.min(max, blockMax - 1);
    }
    return new PermissionRange(permissionName, min, max);
  }
View Full Code Here

TOP

Related Classes of com.google.gerrit.common.data.PermissionRange

Copyright © 2018 www.massapicom. 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.