コード例 #1
0
  @Override
  public void selectSubject(final Subject subject) {
    String uri =
        ResourcePermissionRequestPaths.UriBuilders.PROJECT_PERMISSIONS_SUBJECT
            .create()
            .query(ResourcePermissionRequestPaths.TYPE_QUERY_PARAM, subject.getType().getName())
            .build(project.getName(), subject.getPrincipal());

    ResourceAuthorizationRequestBuilderFactory.newBuilder() //
        .forResource(uri) //
        .authorize(getView().getDeleteAllAuthorizer()) //
        .delete()
        .send();

    ResourceRequestBuilderFactory.<JsArray<Acl>>newBuilder()
        .forResource(uri)
        .get()
        .withCallback(
            new ResourceCallback<JsArray<Acl>>() {
              @Override
              public void onResource(Response response, JsArray<Acl> acls) {
                List<Acl> subjectAcls = JsArrays.toList(acls);
                if (!subjectAcls.isEmpty()) {
                  getView().setSubjectData(subject, subjectAcls);
                } else {
                  // refresh and select another subject if any
                  retrievePermissions();
                }
              }
            })
        .send();
  }
コード例 #2
0
 @Override
 public void deleteAllSubjectPermissions(final Subject subject) {
   String uri =
       ResourcePermissionRequestPaths.UriBuilders.PROJECT_PERMISSIONS_SUBJECT
           .create()
           .query(ResourcePermissionRequestPaths.TYPE_QUERY_PARAM, subject.getType().getName())
           .build(project.getName(), subject.getPrincipal());
   ResourceRequestBuilderFactory.<JsArray<Acl>>newBuilder()
       .forResource(uri)
       .delete()
       .withCallback(
           Response.SC_OK,
           new ResponseCodeCallback() {
             @Override
             public void onResponseCode(Request request, Response response) {
               selectSubject(subject);
             }
           })
       .send();
 }