Author: shane.bryzak(a)jboss.com
Date: 2010-05-30 19:52:25 -0400 (Sun, 30 May 2010)
New Revision: 12908
Modified:
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityManager.java
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityStore.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
Log:
update to match IdentityManager api
Modified:
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityManager.java
===================================================================
---
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityManager.java 2010-05-30
12:09:36 UTC (rev 12907)
+++
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityManager.java 2010-05-30
23:52:25 UTC (rev 12908)
@@ -222,14 +222,4 @@
* @return true if authentication was successful, false otherwise.
*/
boolean authenticate(String username, Credential credential);
-
- IdentityStore getIdentityStore();
-
- void setIdentityStore(IdentityStore identityStore);
-
- IdentityStore getRoleIdentityStore();
-
- void setRoleIdentityStore(IdentityStore roleIdentityStore);
-
- boolean isEnabled();
}
Modified:
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityStore.java
===================================================================
---
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityStore.java 2010-05-30
12:09:36 UTC (rev 12907)
+++
modules/security/trunk/api/src/main/java/org/jboss/seam/security/management/IdentityStore.java 2010-05-30
23:52:25 UTC (rev 12908)
@@ -122,6 +122,41 @@
boolean userExists(String username);
/**
+ *
+ * @param username
+ * @param attribute
+ * @param value
+ * @return
+ */
+ boolean setUserAttribute(String username, String attribute, Object value);
+
+ /**
+ *
+ * @param username
+ * @param attribute
+ * @return
+ */
+ boolean deleteUserAttribute(String username, String attribute);
+
+ /**
+ *
+ * @param username
+ * @param groupName
+ * @param groupType
+ * @return
+ */
+ boolean addUserToGroup(String username, String groupName, String groupType);
+
+ /**
+ *
+ * @param username
+ * @param groupName
+ * @param groupType
+ * @return
+ */
+ boolean removeUserFromGroup(String username, String groupName, String groupType);
+
+ /**
* Creates a new role type with the specified role type name.
* @return true if the role type was created successfully.
*/
@@ -132,20 +167,22 @@
*
* @param name The name of the user
* @param roleType The name of the role type to grant to the user.
- * @param group The name of the group to grant the role in
+ * @param groupName The name of the group to grant the role in
+ * @param groupType The group type
* @return true if the role was successfully granted.
*/
- boolean grantRole(String username, String roleType, Group group);
+ boolean grantRole(String username, String roleType, String groupName, String
groupType);
/**
* Revokes the specified role from the specified user.
*
* @param name The name of the user
* @param roleType The name of the role type to revoke from the user.
- * @param group The name of the group which contains the user role
+ * @param groupName The name of the group which contains the user role
+ * @param groupType The group type
* @return true if the role was successfully revoked.
*/
- boolean revokeRole(String username, String roleType, Group group);
+ boolean revokeRole(String username, String roleType, String groupName, String
groupType);
/**
* Deletes the specified role type.
@@ -199,15 +236,9 @@
* @return
*/
Group findGroup(String name, String groupType);
-
- /**
- * Returns a list of all user names.
- */
- List<String> findUsers();
/**
* Returns a list of all user names containing the specified filter text within their
username.
-
*/
List<String> findUsers(String filter);
@@ -237,7 +268,7 @@
/**
* Lists the members of the specified role
*/
- List<IdentityType> listRoleMembers(String roleType, Group group);
+ List<IdentityType> listRoleMembers(String roleType, String groupName, String
groupType);
/**
* Lists the members of the specified group
Modified:
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java
===================================================================
---
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java 2010-05-30
12:09:36 UTC (rev 12907)
+++
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java 2010-05-30
23:52:25 UTC (rev 12908)
@@ -105,18 +105,42 @@
return identityStore.isUserEnabled(name);
}
- public boolean grantRole(String name, String role, Group group)
+ public boolean setUserAttribute(String username, String attribute, Object value)
{
identity.checkPermission(USER_PERMISSION_NAME, PERMISSION_UPDATE);
- return roleIdentityStore.grantRole(name, role, group);
+ return identityStore.setUserAttribute(username, attribute, value);
}
- public boolean revokeRole(String name, String role, Group group)
+ public boolean deleteUserAttribute(String username, String attribute)
{
identity.checkPermission(USER_PERMISSION_NAME, PERMISSION_UPDATE);
- return roleIdentityStore.revokeRole(name, role, group);
+ return identityStore.deleteUserAttribute(username, attribute);
}
+ public boolean grantRole(String name, String role, String groupName, String
groupType)
+ {
+ identity.checkPermission(USER_PERMISSION_NAME, PERMISSION_UPDATE);
+ return roleIdentityStore.grantRole(name, role, groupName, groupType);
+ }
+
+ public boolean revokeRole(String name, String role, String groupName, String
groupType)
+ {
+ identity.checkPermission(USER_PERMISSION_NAME, PERMISSION_UPDATE);
+ return roleIdentityStore.revokeRole(name, role, groupName, groupType);
+ }
+
+ public boolean addUserToGroup(String username, String groupName, String groupType)
+ {
+ identity.checkPermission(USER_PERMISSION_NAME, PERMISSION_UPDATE);
+ return identityStore.addUserToGroup(username, groupName, groupType);
+ }
+
+ public boolean removeUserFromGroup(String username, String groupName, String
groupType)
+ {
+ identity.checkPermission(USER_PERMISSION_NAME, PERMISSION_UPDATE);
+ return identityStore.removeUserFromGroup(username, groupName, groupType);
+ }
+
public boolean createRoleType(String roleType)
{
identity.checkPermission(ROLE_PERMISSION_NAME, PERMISSION_CREATE);
@@ -129,16 +153,16 @@
return roleIdentityStore.deleteRoleType(roleType);
}
- public boolean createGroup(Group group)
+ public boolean createGroup(String groupName, String groupType)
{
identity.checkPermission(GROUP_PERMISSION_NAME, PERMISSION_CREATE);
- return groupIdentityStore.createGroup(group.getName(), group.getGroupType());
+ return groupIdentityStore.createGroup(groupName, groupType);
}
- public boolean deleteGroup(Group group)
+ public boolean deleteGroup(String groupName, String groupType)
{
identity.checkPermission(GROUP_PERMISSION_NAME, PERMISSION_DELETE);
- return groupIdentityStore.deleteGroup(group.getName(), group.getGroupType());
+ return groupIdentityStore.deleteGroup(groupName, groupType);
}
public boolean removeFromGroup(String username, Group group)
@@ -156,21 +180,7 @@
{
return roleIdentityStore.roleTypeExists(roleType);
}
-
- public List<String> findUsers()
- {
- identity.checkPermission(USER_PERMISSION_NAME, PERMISSION_READ);
- List<String> users = identityStore.findUsers();
- Collections.sort(users, new Comparator<String>() {
- public int compare(String value1, String value2) {
- return value1.compareTo(value2);
- }
- });
-
- return users;
- }
-
public List<String> findUsers(String filter)
{
identity.checkPermission(USER_PERMISSION_NAME, PERMISSION_READ);
@@ -185,7 +195,7 @@
return users;
}
- public List<String> getRoleTypes()
+ public List<String> listRoleTypes()
{
identity.checkPermission(ROLE_PERMISSION_NAME, PERMISSION_READ);
List<String> roles = roleIdentityStore.listRoleTypes();
@@ -234,10 +244,10 @@
return roleIdentityStore.listImpliedRoles(username);
}
- public List<IdentityType> listRoleMembers(String roleType, Group group)
+ public List<IdentityType> listRoleMembers(String roleType, String groupName,
String groupType)
{
identity.checkPermission(ROLE_PERMISSION_NAME, PERMISSION_READ);
- return roleIdentityStore.listRoleMembers(roleType, group);
+ return roleIdentityStore.listRoleMembers(roleType, groupName, groupType);
}
public boolean authenticate(String username, Credential credential)
Modified:
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
===================================================================
---
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2010-05-30
12:09:36 UTC (rev 12907)
+++
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2010-05-30
23:52:25 UTC (rev 12908)
@@ -272,22 +272,22 @@
/**
*
*/
- @Inject PasswordEncoder passwordEncoder;
+ @Inject PasswordEncoder passwordEncoder;
-
- public boolean addUserToGroup(String username, Group group)
+ public boolean addUserToGroup(String username, String groupName,
+ String groupType)
{
// TODO Auto-generated method stub
return false;
}
- public boolean authenticate(String username, Credential credential)
+ public boolean addUserToGroup(String username, Group group)
{
// TODO Auto-generated method stub
return false;
}
- public boolean updateCredential(String username, Credential credential)
+ public boolean authenticate(String username, Credential credential)
{
// TODO Auto-generated method stub
return false;
@@ -305,7 +305,8 @@
return false;
}
- public boolean createUser(String username, Credential credential, Map<String,?>
attributes)
+ public boolean createUser(String username, Credential credential,
+ Map<String, ?> attributes)
{
// TODO Auto-generated method stub
return false;
@@ -329,25 +330,25 @@
return false;
}
- public boolean disableUser(String username)
+ public boolean deleteUserAttribute(String username, String attribute)
{
// TODO Auto-generated method stub
return false;
}
- public boolean enableUser(String username)
+ public boolean disableUser(String username)
{
// TODO Auto-generated method stub
return false;
}
- public Group findGroup(String name, String groupType)
+ public boolean enableUser(String username)
{
// TODO Auto-generated method stub
- return null;
+ return false;
}
- public List<String> findUsers()
+ public Group findGroup(String name, String groupType)
{
// TODO Auto-generated method stub
return null;
@@ -359,7 +360,8 @@
return null;
}
- public boolean grantRole(String username, String roleType, Group group)
+ public boolean grantRole(String username, String roleType, String groupName,
+ String groupType)
{
// TODO Auto-generated method stub
return false;
@@ -395,7 +397,8 @@
return null;
}
- public List<IdentityType> listRoleMembers(String roleType, Group group)
+ public List<IdentityType> listRoleMembers(String roleType, String groupName,
+ String groupType)
{
// TODO Auto-generated method stub
return null;
@@ -407,13 +410,21 @@
return null;
}
+ public boolean removeUserFromGroup(String username, String groupName,
+ String groupType)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
public boolean removeUserFromGroup(String username, Group group)
{
// TODO Auto-generated method stub
return false;
}
- public boolean revokeRole(String username, String roleType, Group group)
+ public boolean revokeRole(String username, String roleType,
+ String groupName, String groupType)
{
// TODO Auto-generated method stub
return false;
@@ -425,15 +436,31 @@
return false;
}
+ public boolean setUserAttribute(String username, String attribute,
+ Object value)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
public boolean supportsFeature(Feature feature)
{
// TODO Auto-generated method stub
return false;
}
+ public boolean updateCredential(String username, Credential credential)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
public boolean userExists(String username)
{
// TODO Auto-generated method stub
return false;
- }
+ }
+
+
+
}