Class User
java.lang.Object
com.adobe.cq.testing.client.security.AbstractAuthorizable
com.adobe.cq.testing.client.security.User
- All Implemented Interfaces:
Authorizable
Object which handles user actions
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
How many millisecond to wait before giving up on waiting for an async index to be updated.protected UserProfile
static final String
Fields inherited from class com.adobe.cq.testing.client.security.AbstractAuthorizable
authorizableId, authorizablePath, client
Fields inherited from interface com.adobe.cq.testing.client.security.Authorizable
ACTION_CREATE_GROUP, ACTION_CREATE_USER, AUTHORIZABLE_ID, IMPERSONATORS, IS_IMPERSONATED, MEMBER_OF, MEMBERS, PARAM_ADD_IMPERSONATORS, PARAM_ADD_MEMBERS, PARAM_AUTHORIZABLE_ID, PARAM_CREATE_GROUP, PARAM_CREATE_USER, PARAM_DELETE, PARAM_INTERMEDIATE_PATH, PARAM_PASSWORD, PARAM_REMOVE_IMPERSONATORS, PARAM_REMOVE_MEMBERS, PROFILE, SCHEMA_AUTHORIZABLE, SELECTOR, SELECTOR_USERPROPERTIES, TYPE, TYPE_GROUP, TYPE_USER, WILDCARD
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T extends User>
org.apache.sling.testing.clients.SlingHttpResponseaddImpersonators
(T[] authorizables, int... expectedStatus) Adds impersonators to the user.static <T extends SecurityClient>
UsercreateUser
(T client, String userId, String password, String intermediatePath, Map<String, String> profileMap, boolean waitForIndex, int... expectedStatus) Deprecated.waitForIndex parameter is not needed.static <T extends SecurityClient>
UsercreateUser
(T client, String userId, String password, String intermediatePath, Map<String, String> profileMap, int... expectedStatus) Creates a new user.Get root path of the authorizable (user/group) in repositoryGet user profileprotected void
<T extends User>
org.apache.sling.testing.clients.SlingHttpResponseremoveImpersonators
(T[] authorizables, int... expectedStatus) Remove impersonators from the userMethods inherited from class com.adobe.cq.testing.client.security.AbstractAuthorizable
buildAuthorizableList, buildAuthorizablePath, create, delete, doGet, doPost, encodePathToURL, encodeURI, exists, exists, exists, getAuthorizableClass, getClient, getHomePath, getHomeUrl, getId, getImpersonators, getJsonAsString, getMemberOf, getMembers, getProfile, getQuery, getUserPropertiesJsonAsString, isImpersonated
-
Field Details
-
ROOT_PATH
- See Also:
-
MAX_ASYNC_WAIT_MILLIS
public static final int MAX_ASYNC_WAIT_MILLISHow many millisecond to wait before giving up on waiting for an async index to be updated.
By default it will wait
6000
ms but it can be fine tuned with, for example-Dgranite.it.maxasync=12000
-
profile
-
-
Constructor Details
-
User
public User(T client, String authorizableId) throws org.apache.sling.testing.clients.ClientException, InterruptedException - Throws:
org.apache.sling.testing.clients.ClientException
InterruptedException
-
-
Method Details
-
getRootPath
Description copied from interface:Authorizable
Get root path of the authorizable (user/group) in repository- Returns:
- root path
-
addImpersonators
public <T extends User> org.apache.sling.testing.clients.SlingHttpResponse addImpersonators(T[] authorizables, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException, InterruptedException Adds impersonators to the user.- Type Parameters:
T
- user type- Parameters:
authorizables
- list of anyUser
objectsexpectedStatus
- list of allowed HTTP Status to be returned.- Returns:
- Sling response
- Throws:
org.apache.sling.testing.clients.ClientException
- if something fails during request/response cycleInterruptedException
- if waiting was interrupted
-
removeImpersonators
public <T extends User> org.apache.sling.testing.clients.SlingHttpResponse removeImpersonators(T[] authorizables, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException Remove impersonators from the user- Type Parameters:
T
- user type- Parameters:
authorizables
- list of anyUser
objectsexpectedStatus
- list of allowed HTTP Status to be returned.- Returns:
- Sling response
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycle
-
getUserProfile
Get user profile- Returns:
UserProfile
- Throws:
org.apache.sling.testing.clients.ClientException
- if the request failed
-
initProfile
protected void initProfile() throws org.apache.sling.testing.clients.ClientException- Throws:
org.apache.sling.testing.clients.ClientException
-
createUser
public static <T extends SecurityClient> User createUser(T client, String userId, String password, String intermediatePath, Map<String, String> profileMap, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException, InterruptedExceptionCreates a new user.- Type Parameters:
T
- client type- Parameters:
client
- any class implementing theSecurityClient
.userId
- the user ID for the new user.password
- the password to be assigned.intermediatePath
- the root path user will be created.profileMap
- profile properties to be set for the new user.expectedStatus
- list of allowed HTTP Status to be returned. If not set, http status 201 (CREATED) is assumed.- Returns:
User
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycleInterruptedException
- to mark this method as "waiting"
-
createUser
@Deprecated public static <T extends SecurityClient> User createUser(T client, String userId, String password, String intermediatePath, Map<String, String> profileMap, boolean waitForIndex, int... expectedStatus) throws org.apache.sling.testing.clients.ClientException, InterruptedExceptionDeprecated.waitForIndex parameter is not needed. UsecreateUser(SecurityClient, String, String, String, Map, int...)
Creates a new user.- Type Parameters:
T
- client type- Parameters:
client
- any class implementing theSecurityClient
.userId
- the user ID for the new user.password
- the password to be assigned.intermediatePath
- the root path user will be created.profileMap
- profile properties to be set for the new user.waitForIndex
- Whether or not to wait for indexing to be complete before returningexpectedStatus
- list of allowed HTTP Status to be returned. If not set, http status 201 (CREATED) is assumed.- Returns:
User
- Throws:
org.apache.sling.testing.clients.ClientException
- If something fails during request/response cycleInterruptedException
- to mark this method as "waiting"
-