use of org.apache.jackrabbit.api.security.user.UserManager in project jackrabbit-oak by apache.
the class UserManagementTest method testDisableUserWithoutPermission2.
@Test
public void testDisableUserWithoutPermission2() throws Exception {
createUser(userId);
modify("/", PrivilegeConstants.REP_WRITE, true);
UserManager testUserMgr = getUserManager(testSession);
User user = (User) testUserMgr.getAuthorizable(userId);
try {
user.disable("disabled!");
testSession.save();
fail();
} catch (AccessDeniedException e) {
// success
}
}
use of org.apache.jackrabbit.api.security.user.UserManager in project jackrabbit-oak by apache.
the class UserManagementTest method testChangeUserPropertiesWithoutPermission.
@Test
public void testChangeUserPropertiesWithoutPermission() throws Exception {
createUser(userId);
// testSession has read-only access
UserManager testUserMgr = getUserManager(testSession);
try {
Authorizable a = testUserMgr.getAuthorizable(userId);
a.setProperty("someProp", testSession.getValueFactory().createValue("value"));
testSession.save();
fail("Test session doesn't have sufficient permission to alter user properties.");
} catch (AccessDeniedException e) {
// success
}
}
use of org.apache.jackrabbit.api.security.user.UserManager in project jackrabbit-oak by apache.
the class UserManagementTest method testCreateUser.
@Test
public void testCreateUser() throws Exception {
UserManager testUserMgr = getUserManager(testSession);
modify("/", PrivilegeConstants.REP_USER_MANAGEMENT, true);
// creating user should succeed
testUserMgr.createUser(userId, "pw");
testSession.save();
}
use of org.apache.jackrabbit.api.security.user.UserManager in project jackrabbit-oak by apache.
the class UserManagementTest method testChangePassword.
@Test
public void testChangePassword() throws Exception {
createUser(userId);
// after granting user-mgt privilege changing the pw must succeed.
modify("/", PrivilegeConstants.REP_USER_MANAGEMENT, true);
UserManager testUserMgr = getUserManager(testSession);
User user = (User) testUserMgr.getAuthorizable(userId);
user.changePassword("pw2");
testSession.save();
}
use of org.apache.jackrabbit.api.security.user.UserManager in project jackrabbit-oak by apache.
the class UserManagementTest method testChangePasswordWithoutPermission2.
@Test
public void testChangePasswordWithoutPermission2() throws Exception {
createUser(userId);
modify("/", PrivilegeConstants.REP_WRITE, true);
UserManager testUserMgr = getUserManager(testSession);
User user = (User) testUserMgr.getAuthorizable(userId);
try {
user.changePassword("pw2");
testSession.save();
fail();
} catch (AccessDeniedException e) {
// success
}
}
Aggregations