Class User
- java.lang.Object
-
- com.adobe.cq.testing.client.security.AbstractAuthorizable
-
- com.adobe.cq.testing.client.security.User
-
- All Implemented Interfaces:
Authorizable
public class User extends AbstractAuthorizable
Object which handles user actions
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_ASYNC_WAIT_MILLIS
How many millisecond to wait before giving up on waiting for an async index to be updated.protected UserProfile
profile
static String
ROOT_PATH
-
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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <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.String
getRootPath()
Get root path of the authorizable (user/group) in repositoryUserProfile
getUserProfile()
Get user profileprotected void
initProfile()
<T extends User>
org.apache.sling.testing.clients.SlingHttpResponseremoveImpersonators(T[] authorizables, int... expectedStatus)
Remove impersonators from the user-
Methods 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 Detail
-
ROOT_PATH
public static final String ROOT_PATH
- See Also:
- Constant Field Values
-
MAX_ASYNC_WAIT_MILLIS
public static final int MAX_ASYNC_WAIT_MILLIS
How 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
protected UserProfile profile
-
-
Constructor Detail
-
User
public User(T client, String authorizableId) throws org.apache.sling.testing.clients.ClientException, InterruptedException
- Throws:
org.apache.sling.testing.clients.ClientException
InterruptedException
-
-
Method Detail
-
getRootPath
public String 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
public UserProfile getUserProfile() throws org.apache.sling.testing.clients.ClientException
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, InterruptedException
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.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, InterruptedException
Deprecated.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"
-
-