@Override public boolean isAuthorized(final ResourceIdentifier resource, final Activity intent) { boolean allowed = false; if (resource.getResourceId() != null) { allowed = isAuthorized(String.format(resTemplate, resource.toString()), intent); } if (!allowed && resource.getTenantId() != null) { allowed = isAuthorized(String.format(resTemplate, resource.getEndpoint() + "/" + resource.getTenantId()), intent) || isAuthorized(String.format(resTemplate, resource.getEndpoint() + "/*"), intent); } if (!allowed) { allowed = isAuthorized(String.format(resTemplate, resource.getEndpoint()), intent) || isAuthorized(String.format(resTemplate, "*"), intent); } return allowed; }
@Override public boolean isAuthorized(final ResourceIdentifier resource, final Activity intent) { boolean allowed = false; if (resource.getResourceId() != null) { allowed = isAuthorized(String.format(resTemplate, resource.toString()), intent); } if (!allowed && resource.getTenantId() != null) { allowed = isAuthorized(String.format(resTemplate, resource.getEndpoint() + "/" + resource.getTenantId()), intent) || isAuthorized(String.format(resTemplate, resource.getEndpoint() + "/*"), intent); } if (!allowed) { allowed = isAuthorized(String.format(resTemplate, resource.getEndpoint()), intent) || isAuthorized(String.format(resTemplate, "*"), intent); } return allowed; }
@Override public boolean isAuthorized(final ResourceIdentifier resource, final String operation) { boolean allowed = false; if (resource.getResourceId() != null) { allowed = isAuthorized(String.format(opTemplate, resource.toString(), operation), Activity.EXECUTE) || isAuthorized(String.format(opTemplate, resource.toString(), "*"), Activity.EXECUTE); } if (!allowed && resource.getTenantId() != null) { allowed = isAuthorized(String.format(opTemplate, resource.getEndpoint() + "/" + resource.getTenantId(), operation), Activity.EXECUTE) || isAuthorized(String.format(opTemplate, resource.getEndpoint() + "/" + resource.getTenantId(), "*"), Activity.EXECUTE) || isAuthorized(String.format(opTemplate, resource.getEndpoint() + "/*", operation), Activity.EXECUTE) || isAuthorized(String.format(opTemplate, resource.getEndpoint() + "/*", "*"), Activity.EXECUTE); } if (!allowed) { allowed = isAuthorized(String.format(opTemplate, resource.getEndpoint(), operation), Activity.EXECUTE) || isAuthorized(String.format(opTemplate, resource.getEndpoint(), "*"), Activity.EXECUTE) || isAuthorized(String.format(opTemplate, "*", operation), Activity.EXECUTE) || isAuthorized(String.format(opTemplate, "*", "*"), Activity.EXECUTE); } return allowed; }
@Override public boolean isAuthorized(final ResourceIdentifier resource, final String operation) { boolean allowed = false; if (resource.getResourceId() != null) { allowed = isAuthorized(String.format(opTemplate, resource.toString(), operation), Activity.EXECUTE) || isAuthorized(String.format(opTemplate, resource.toString(), "*"), Activity.EXECUTE); } if (!allowed && resource.getTenantId() != null) { allowed = isAuthorized(String.format(opTemplate, resource.getEndpoint() + "/" + resource.getTenantId(), operation), Activity.EXECUTE) || isAuthorized(String.format(opTemplate, resource.getEndpoint() + "/" + resource.getTenantId(), "*"), Activity.EXECUTE) || isAuthorized(String.format(opTemplate, resource.getEndpoint() + "/*", operation), Activity.EXECUTE) || isAuthorized(String.format(opTemplate, resource.getEndpoint() + "/*", "*"), Activity.EXECUTE); } if (!allowed) { allowed = isAuthorized(String.format(opTemplate, resource.getEndpoint(), operation), Activity.EXECUTE) || isAuthorized(String.format(opTemplate, resource.getEndpoint(), "*"), Activity.EXECUTE) || isAuthorized(String.format(opTemplate, "*", operation), Activity.EXECUTE) || isAuthorized(String.format(opTemplate, "*", "*"), Activity.EXECUTE); } return allowed; }