The user principal.
261262263264265266267268269270271
} catch (SecurityException sex) { } UserPrincipal user = new UserPrincipalImpl("anon"); FolderPermission perm1 = new FolderPermission("/files/test.xml", "edit"); FolderPermission perm2 = new FolderPermission("/files/subfolder1/*", "view"); FolderPermission perm3 = new FolderPermission("/files/subfolder2/-", "view"); try
9899100101102103104105106
/** * @throws Exception */ public void testRemoveExistantUserPrincipal() throws Exception { UserPrincipal up = new UserPrincipalImpl(uid1); userHandler.removeUserPrincipal(up); assertTrue("User was found and should have been removed.", userHandler.getUserPrincipal(uid1) == null); }
109110111112113114115116117
* @throws Exception */ public void testRemoveNonExistantUserPrincipal() throws Exception { String localUid = Integer.toString(rand.nextInt()).toString(); UserPrincipal localPrin = new UserPrincipalImpl(localUid); userHandler.removeUserPrincipal(localPrin); }
484950515253545556
/** The {@link RoleSecurityHandler}. */ private static RoleSecurityHandler roleHandler; public static void seedUserData(String uid, String password) throws Exception { UserPrincipal up = new UserPrincipalImpl(uid); userHandler.addUserPrincipal(up); crHandler.setPassword(uid, "", password); }
6768697071727374
roleHandler.setRolePrincipal(rp); } public static void removeUserData(String uid) throws Exception { UserPrincipal up = new UserPrincipalImpl(uid); userHandler.removeUserPrincipal(up); }
107108109110111112113114115116117118
{ User user = null; try { user = um.getUser(userName); UserPrincipal userPrincipal = (UserPrincipal)SecurityHelper.getPrincipal(user.getSubject(), UserPrincipal.class); if ( !userPrincipal.isEnabled() ) { request.setSessionAttribute(LoginConstants.ERRORCODE, LoginConstants.ERROR_USER_DISABLED); } else {
274275276277278279280281282283284285
// Check if user already exists. if (userExists(username)) { throw new SecurityException(SecurityException.USER_ALREADY_EXISTS.create(username)); } UserPrincipal userPrincipal = new UserPrincipalImpl(username); String fullPath = userPrincipal.getFullPath(); // Add the preferences. Preferences preferences = Preferences.userRoot().node(fullPath); if (log.isDebugEnabled()) { log.debug("Added user preferences node: " + fullPath);
349350351352353354355356357358359360
{ username}, new String[] { "username"}, "removeUser(java.lang.String)"); if (getAnonymousUser().equals(username)) { throw new SecurityException( SecurityException.ANONYMOUS_USER_PROTECTED.create(username)); } UserPrincipal userPrincipal = new UserPrincipalImpl(username); String fullPath = userPrincipal.getFullPath(); atnProviderProxy.removeUserPrincipal(userPrincipal); // Remove preferences Preferences preferences = Preferences.userRoot().node(fullPath); try {
240241242243244245246247248249250251
if ( getAnonymousUser().equals(username) ) { throw new SecurityException(SecurityException.ANONYMOUS_USER_PROTECTED); } UserPrincipal userPrincipal = new UserPrincipalImpl(username); String fullPath = userPrincipal.getFullPath(); atnProviderProxy.removeUserPrincipal(userPrincipal); // Remove preferences Preferences preferences = Preferences.userRoot().node(fullPath); try {
260261262263264265266267268269270