I - Operation execution inputO - Operation execution outputpublic abstract class ServiceOperation<I,O> extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
ServiceOperation(TokenVerifier tokenVerifier,
OrganizationsRepository repository) |
| Modifier and Type | Method and Description |
|---|---|
protected Predicate<ApiKey> |
apiKeyFilterBy(Role role) |
protected void |
checkIsMember(String userId,
Organization organization) |
protected void |
checkLastOwner(String userId,
Organization organization) |
protected void |
checkMemberAccess(Organization organization,
io.scalecube.security.api.Profile profile) |
protected void |
checkOwnerAccess(Organization organization,
io.scalecube.security.api.Profile profile) |
protected void |
checkSuperUserAccess(Organization organization,
io.scalecube.security.api.Profile profile) |
reactor.core.publisher.Mono<O> |
execute(I request)
Executes the request argument.
|
protected reactor.core.publisher.Mono<Organization> |
getOrganization(String id) |
protected GetOrganizationResponse |
getOrganizationResponse(Organization organization,
Predicate<ApiKey> filter) |
protected Role |
getRole(String userId,
Organization organization) |
protected abstract Token |
getToken(I request) |
protected boolean |
isInRole(String userId,
Organization organization,
Role role) |
protected boolean |
isLastOwner(Organization organization,
String userId) |
protected boolean |
isOwner(Organization organization,
io.scalecube.security.api.Profile profile) |
protected boolean |
isSuperUser(Organization organization,
io.scalecube.security.api.Profile profile) |
protected OrganizationInfo.Builder |
organizationInfo(Organization organization,
Predicate<ApiKey> filter) |
protected abstract reactor.core.publisher.Mono<O> |
process(I request,
OperationServiceContext context) |
protected static void |
requireNonNullOrEmpty(Object object,
String message) |
protected static void |
throwNotOrgOwnerException(io.scalecube.security.api.Profile owner,
Organization organization) |
protected Role |
toRole(String role) |
protected reactor.core.publisher.Mono<Void> |
validate(I request,
OperationServiceContext context) |
protected ServiceOperation(TokenVerifier tokenVerifier, OrganizationsRepository repository)
public reactor.core.publisher.Mono<O> execute(I request) throws ServiceOperationException
request - the request to executeServiceOperationException - in case of an error during request executionprotected reactor.core.publisher.Mono<Void> validate(I request, OperationServiceContext context)
protected abstract reactor.core.publisher.Mono<O> process(I request, OperationServiceContext context)
protected reactor.core.publisher.Mono<Organization> getOrganization(String id) throws OrganizationNotFoundException
OrganizationNotFoundExceptionprotected GetOrganizationResponse getOrganizationResponse(Organization organization, Predicate<ApiKey> filter)
protected OrganizationInfo.Builder organizationInfo(Organization organization, Predicate<ApiKey> filter)
protected void checkMemberAccess(Organization organization, io.scalecube.security.api.Profile profile) throws AccessPermissionException, EntityNotFoundException
protected boolean isOwner(Organization organization, io.scalecube.security.api.Profile profile) throws EntityNotFoundException
EntityNotFoundExceptionprotected boolean isLastOwner(Organization organization, String userId) throws EntityNotFoundException
EntityNotFoundExceptionprotected boolean isSuperUser(Organization organization, io.scalecube.security.api.Profile profile) throws EntityNotFoundException
EntityNotFoundExceptionprotected Role getRole(String userId, Organization organization)
protected boolean isInRole(String userId, Organization organization, Role role) throws EntityNotFoundException
EntityNotFoundExceptionprotected static void throwNotOrgOwnerException(io.scalecube.security.api.Profile owner,
Organization organization)
throws AccessPermissionException
AccessPermissionExceptionprotected void checkOwnerAccess(Organization organization, io.scalecube.security.api.Profile profile) throws AccessPermissionException, EntityNotFoundException
protected void checkSuperUserAccess(Organization organization, io.scalecube.security.api.Profile profile) throws AccessPermissionException, EntityNotFoundException
protected void checkLastOwner(String userId, Organization organization) throws EntityNotFoundException
EntityNotFoundExceptionprotected void checkIsMember(String userId, Organization organization) throws NotAnOrganizationMemberException
NotAnOrganizationMemberExceptionCopyright © 2015–2019. All rights reserved.