public class AuthorizableManager extends Object
Authorizables| Modifier and Type | Field and Description |
|---|---|
static String |
AUTHORIZABLE_POST_PATH
POST path for Authorizable
|
static String |
AUTHORIZABLES |
static String |
AUTHORIZABLES_PATH
Path to JSON representing the authorizables
|
protected SecurityClient |
client
The security granite HTTP client
|
| Constructor and Description |
|---|
AuthorizableManager(T client) |
| Modifier and Type | Method and Description |
|---|---|
<T extends SecurityClient> |
create(T client,
Class<? extends AbstractAuthorizable> authorizableClass,
String authorizableId,
org.apache.sling.testing.clients.util.FormEntityBuilder formParameters,
int... expectedStatus)
Creates a new
Authorizable. |
org.apache.sling.testing.clients.SlingHttpResponse |
doPost(org.apache.sling.testing.clients.util.FormEntityBuilder formParameters,
int... expectedStatus)
POST request to AuthorizableServlet.
|
protected <T extends AbstractAuthorizable> |
getAuthorizable(Class<T> authorizableClass,
String authorizableId)
Get an instance of any class extending
AbstractAuthorizable
with given ID. |
List<Authorizable> |
getAuthorizables(String query)
Get all authorizables from Json as list of
Authorizables. |
String |
getAuthorizablesJson(String query)
Get all authorizables as json String.
|
Group |
getGroup(String groupId)
Get an existing group object from the id.
|
Group |
getGroupAdministrators()
Get built-in group "administrators"
|
Group |
getGroupContributor()
Get built-in group "contributor"
|
Group |
getGroupEveryone()
Get built-in group "everyone"
|
Group |
getGroupUserAdministrators()
Get built-in group "user-administrators"
|
User |
getUser(String userId)
Get an existing user object from the id.
|
public static final String AUTHORIZABLE_POST_PATH
public static final String AUTHORIZABLES_PATH
public static final String AUTHORIZABLES
protected final SecurityClient client
public Group getGroupAdministrators() throws org.apache.sling.testing.clients.ClientException
Grouporg.apache.sling.testing.clients.ClientException - if the request failedpublic Group getGroupContributor() throws org.apache.sling.testing.clients.ClientException
Grouporg.apache.sling.testing.clients.ClientException - if the request failedpublic Group getGroupEveryone() throws org.apache.sling.testing.clients.ClientException
Grouporg.apache.sling.testing.clients.ClientException - if the request failedpublic Group getGroupUserAdministrators() throws org.apache.sling.testing.clients.ClientException
Grouporg.apache.sling.testing.clients.ClientException - if the request failedpublic User getUser(String userId) throws org.apache.sling.testing.clients.ClientException
userId - the user ID.Userorg.apache.sling.testing.clients.ClientException - If something fails during request/response cyclepublic Group getGroup(String groupId) throws org.apache.sling.testing.clients.ClientException
groupId - the group ID.Grouporg.apache.sling.testing.clients.ClientException - If something fails during request/response cyclepublic <T extends SecurityClient> Authorizable create(T client, Class<? extends AbstractAuthorizable> authorizableClass, String authorizableId, org.apache.sling.testing.clients.util.FormEntityBuilder formParameters, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException
Authorizable.T - client typeclient - any class implementing the SecurityClient.authorizableClass - Authorizable class to be created.authorizableId - the ID for the new authorizable.formParameters - form parameters.expectedStatus - list of allowed HTTP Status to be returned. If not set,
http status 201 (CREATED) is assumed.Authorizableorg.apache.sling.testing.clients.ClientException - If something fails during request/response cycleprotected <T extends AbstractAuthorizable> T getAuthorizable(Class<T> authorizableClass, String authorizableId) throws org.apache.sling.testing.clients.ClientException
AbstractAuthorizable
with given ID. Home path for authorizable is assumed in default structure.
T - any class extending AbstractAuthorizableauthorizableClass - any class extending the AbstractAuthorizableauthorizableId - the authorizable ID.org.apache.sling.testing.clients.ClientException - if client can't be instantiatedpublic List<Authorizable> getAuthorizables(String query) throws org.apache.sling.testing.clients.ClientException
Authorizables.query - search query for authorizablesAuthorizableorg.apache.sling.testing.clients.ClientException - if the request failedpublic String getAuthorizablesJson(String query) throws org.apache.sling.testing.clients.ClientException
query - search query for authorizablesorg.apache.sling.testing.clients.ClientException - if the request failedpublic org.apache.sling.testing.clients.SlingHttpResponse doPost(org.apache.sling.testing.clients.util.FormEntityBuilder formParameters,
int... expectedStatus)
throws org.apache.sling.testing.clients.ClientException
formParameters - form parameters.expectedStatus - list of allowed HTTP Status to be returned.org.apache.sling.testing.clients.ClientException - if the request failedCopyright © 2018. All rights reserved.