Ejemplo n.º 1
0
    @Override
    public int compare(Acl o1, Acl o2) {
      ResourcePermissionType t1 = ResourcePermissionType.getTypeByPermission(o1.getActions(0));
      ResourcePermissionType t2 = ResourcePermissionType.getTypeByPermission(o2.getActions(0));

      if (t1.ordinal() < t2.ordinal()) {
        return 1;
      }

      if (t1.ordinal() > t2.ordinal()) {
        return -1;
      }

      return 0;
    }
Ejemplo n.º 2
0
  public void deletePermission(Acl acl) {
    final Subject subject = acl.getSubject();
    String nodeUri =
        getNodeUri(
            ResourcePermissionType.getTypeByPermission(acl.getActions(0)),
            acl.getResource(),
            subject.getPrincipal(),
            subject.getType().getName());

    ResourceRequestBuilderFactory.<JsArray<Acl>>newBuilder()
        .forResource(nodeUri)
        .delete()
        .withCallback(
            Response.SC_OK,
            new ResponseCodeCallback() {
              @Override
              public void onResponseCode(Request request, Response response) {
                selectSubject(subject);
              }
            }) //
        .withCallback(
            Response.SC_FORBIDDEN,
            new ResponseCodeCallback() {
              @Override
              public void onResponseCode(Request request, Response response) {
                // ignore
              }
            }) //
        .send();
  }
Ejemplo n.º 3
0
 @Override
 public String map(Acl acl) {
   ResourcePermissionType type = ResourcePermissionType.getTypeByPermission(acl.getActions(0));
   return TranslationsUtils.replaceArguments(
       translations.permissionResourceNodeTypeMap().get(type.name()));
 }
Ejemplo n.º 4
0
 @Override
 public String format(Acl acl) {
   return getName(
       ResourcePermissionType.getTypeByPermission(acl.getActions(0)),
       new AclResourceTokenizer(acl.getResource()));
 }
Ejemplo n.º 5
0
 @Override
 public PlaceRequest map(Acl acl) {
   return getPlaceRequest(
       ResourcePermissionType.getTypeByPermission(acl.getActions(0)),
       new AclResourceTokenizer(acl.getResource()));
 }