public String createUserGroup(ServiceHost target, String name, Query q) throws Throwable { URI postUserGroupsUri = UriUtils.buildUri(target, ServiceUriPaths.CORE_AUTHZ_USER_GROUPS); String selfLink = UriUtils.extendUri(postUserGroupsUri, name).getPath(); // Create user group UserGroupState userGroupState = UserGroupState.Builder.create() .withSelfLink(selfLink) .withQuery(q) .build(); this.host.sendAndWaitExpectSuccess(Operation .createPost(postUserGroupsUri) .setBody(userGroupState)); return selfLink; }
public String createUserGroup(ServiceHost target, String name, Query q) throws Throwable { URI postUserGroupsUri = UriUtils.buildUri(target, ServiceUriPaths.CORE_AUTHZ_USER_GROUPS); String selfLink = UriUtils.extendUri(postUserGroupsUri, name).getPath(); // Create user group UserGroupState userGroupState = UserGroupState.Builder.create() .withSelfLink(selfLink) .withQuery(q) .build(); this.host.sendAndWaitExpectSuccess(Operation .createPost(postUserGroupsUri) .setBody(userGroupState)); return selfLink; }
.create() .withQuery(userGroupQuery) .withSelfLink(userGroupSelfLink) .build();
userGroupQuery.setTermMatchValue(userState.email); UserGroupState userGroupState = UserGroupState.Builder.create() .withSelfLink(user + "-user-group") .withQuery(userGroupQuery) .build();
userGroupQuery.setTermMatchValue(userState.email); UserGroupState userGroupState = UserGroupState.Builder.create() .withSelfLink(user + "-user-group") .withQuery(userGroupQuery) .build();
.withSelfLink(servicePath) .withQuery(query) .build();
.withSelfLink(userGroupUri) .withQuery(userGroupQuery).build();
.withSelfLink(servicePath) .withQuery(query) .build();
.withSelfLink(this.userGroupSelfLink) .build();
private void createUserGroup(LocalPrincipalState state, Operation op) { String userGroupSelfLink = UriUtils.buildUriPath(UserGroupService.FACTORY_LINK, encode(state.name)); Query userGroupQuery = AuthUtil.buildQueryForUsers(userGroupSelfLink); UserGroupState userGroupState = UserGroupState.Builder.create() .withSelfLink(userGroupSelfLink) .withQuery(userGroupQuery) .build(); URI userGroupFactoryUri = UriUtils.buildUri(getHost(), ServiceUriPaths.CORE_AUTHZ_USER_GROUPS); Operation postGroup = Operation.createPost(userGroupFactoryUri) .addPragmaDirective(Operation.PRAGMA_DIRECTIVE_FORCE_INDEX_UPDATE) .setBody(userGroupState) .setReferer(op.getUri()) .setCompletion((o, ex) -> { if (ex != null) { logWarning("Unable to create user group %s: %s", state.name, Utils.toString(ex)); return; } UserGroupState groupState = o.getBody(UserGroupState.class); addUsersToGroup(state, groupState.documentSelfLink, op); }); addReplicationFactor(postGroup); sendRequest(postGroup); }
private static DeferredResult<UserGroupState> createUserGroup(Service service, String principalId) { String userGroupSelfLink = UriUtils .buildUriPath(UserGroupService.FACTORY_LINK, encode(principalId)); Query userGroupQuery = AuthUtil.buildQueryForUsers(userGroupSelfLink); UserGroupState userGroupState = UserGroupState.Builder.create() .withSelfLink(userGroupSelfLink) .withQuery(userGroupQuery) .build(); Operation postGroup = Operation.createPost(service, ServiceUriPaths.CORE_AUTHZ_USER_GROUPS) .addPragmaDirective(Operation.PRAGMA_DIRECTIVE_FORCE_INDEX_UPDATE) .setBody(userGroupState); addReplicationFactor(postGroup); return service.sendWithDeferredResult(postGroup, UserGroupState.class); }
public static UserGroupState buildUserGroupState(String identifier) { String selfLink = UriUtils.buildUriPath(UserGroupService.FACTORY_LINK, identifier); Query userGroupQuery = buildQueryForUsers(selfLink); UserGroupState userGroupState = UserGroupState.Builder .create() .withQuery(userGroupQuery) .withSelfLink(selfLink) .build(); return userGroupState; }