[portal-commits] JBoss Portal SVN: r12947 - in modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src: main/org/jboss/portal/identity/service and 3 other directories.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Wed Mar 4 18:17:50 EST 2009


Author: sviluppatorefico
Date: 2009-03-04 18:17:50 -0500 (Wed, 04 Mar 2009)
New Revision: 12947

Modified:
   modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java
   modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/RoleModule.java
   modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/UserModule.java
   modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/RoleModuleService.java
   modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/UserModuleService.java
   modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java
   modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtRoleModuleTestCase.java
   modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtUserModuleTestCase.java
   modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/resources/test/config/db-config.xml
Log:
see https://jira.jboss.org/jira/browse/JBPORTAL-2283

Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java	2009-03-04 18:45:19 UTC (rev 12946)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/IdentityConfiguration.java	2009-03-04 23:17:50 UTC (rev 12947)
@@ -99,7 +99,9 @@
 
    public static final String SEARCH_SCOPE = "searchScope";
 
+   public static final String ADMIN_ROLES = "adminRoles";
 
+   public static final String ADMIN_USERS = "adminUsers";
 
    public Set getValues(String optionGroup, String option);
 

Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/RoleModule.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/RoleModule.java	2009-03-04 18:45:19 UTC (rev 12946)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/RoleModule.java	2009-03-04 23:17:50 UTC (rev 12947)
@@ -97,6 +97,13 @@
     * @return the roles
     */
    Set findRoles() throws IdentityException;
+ 
+   /**
+    * Get all the administrator roles
+    *
+    * @return the role names
+    */
+   Set<String> getAdminRoles() throws IdentityException;
 
 
 }

Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/UserModule.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/UserModule.java	2009-03-04 18:45:19 UTC (rev 12946)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/UserModule.java	2009-03-04 23:17:50 UTC (rev 12947)
@@ -100,4 +100,11 @@
     * @return the number of users
     */
    int getUserCount() throws IdentityException, IllegalArgumentException;
+ 
+   /**
+    * Get all the administrator roles
+    *
+    * @return the role names
+    */
+   Set<String> getAdminUsers() throws IdentityException;
 }

Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/RoleModuleService.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/RoleModuleService.java	2009-03-04 18:45:19 UTC (rev 12946)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/RoleModuleService.java	2009-03-04 23:17:50 UTC (rev 12947)
@@ -21,9 +21,12 @@
 */
 package org.jboss.portal.identity.service;
 
-import org.jboss.portal.identity.RoleModule;
+import java.util.Set;
+
+import org.jboss.portal.identity.IdentityConfiguration;
 import org.jboss.portal.identity.IdentityContext;
 import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.RoleModule;
 import org.jboss.portal.identity.event.RoleCreatedEvent;
 import org.jboss.portal.identity.event.RoleDestroyedEvent;
 import org.jboss.portal.identity.event.RoleUpdatedEvent;
@@ -60,5 +63,15 @@
       RoleUpdatedEvent event = new RoleUpdatedEvent(roleId, roleName, displayName);
       getIdentityEventBroadcaster().fireEvent(event);
    }
+
+   public Set<String> getAdminRoles() throws IdentityException
+   {
+      Set<String> adminRoles = (Set<String>)getIdentityConfiguration().getOptions(IdentityConfiguration.GROUP_COMMON).get(IdentityConfiguration.ADMIN_ROLES);
+      if (adminRoles == null) 
+      {
+         throw new IdentityException("Configuration option missing: " + IdentityConfiguration.ADMIN_ROLES);   
+      }
+      return adminRoles;
+   }
    
 }

Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/UserModuleService.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/UserModuleService.java	2009-03-04 18:45:19 UTC (rev 12946)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/UserModuleService.java	2009-03-04 23:17:50 UTC (rev 12947)
@@ -21,9 +21,12 @@
 */
 package org.jboss.portal.identity.service;
 
-import org.jboss.portal.identity.UserModule;
+import java.util.Set;
+
+import org.jboss.portal.identity.IdentityConfiguration;
 import org.jboss.portal.identity.IdentityContext;
 import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.UserModule;
 import org.jboss.portal.identity.event.IdentityEvent;
 import org.jboss.portal.identity.event.UserCreatedEvent;
 import org.jboss.portal.identity.event.UserDestroyedEvent;
@@ -52,5 +55,15 @@
       IdentityEvent event = new UserDestroyedEvent(userId, userName);
       getIdentityEventBroadcaster().fireEvent(event);
    }
+
+   public Set<String> getAdminUsers() throws IdentityException
+   {
+      Set<String> adminUsers = (Set<String>)getIdentityConfiguration().getOptions(IdentityConfiguration.GROUP_COMMON).get(IdentityConfiguration.ADMIN_USERS);
+      if (adminUsers == null) 
+      {
+         throw new IdentityException("Configuration option missing: " + IdentityConfiguration.ADMIN_USERS);   
+      }
+      return adminUsers;
+   }
    
 }

Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java	2009-03-04 18:45:19 UTC (rev 12946)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java	2009-03-04 23:17:50 UTC (rev 12947)
@@ -21,15 +21,19 @@
 */
 package org.jboss.portal.test.identity.db;
 
+import junit.framework.TestSuite;
+
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.ProfileMap;
+import org.jboss.portal.identity.User;
 import org.jboss.portal.identity.db.HibernateUserImpl;
-import org.jboss.portal.identity.*;
+import org.jboss.portal.identity.service.MembershipModuleService;
+import org.jboss.portal.identity.service.RoleModuleService;
 import org.jboss.portal.identity.service.UserModuleService;
 import org.jboss.portal.identity.service.UserProfileModuleService;
-import org.jboss.portal.identity.service.MembershipModuleService;
-import org.jboss.portal.identity.service.RoleModuleService;
 import org.jboss.portal.test.identity.IdentityTest;
 import org.jboss.portal.test.identity.TestServiceLoader;
-import junit.framework.TestSuite;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -205,4 +209,30 @@
    {
       utc.testStaticProperty();
    }
+
+   public void testGetAdminUsers() throws Exception
+   {
+      try
+      {
+         userModule.getAdminUsers();
+      }
+      catch (IdentityException e)
+      {
+         fail();
+      }
+
+   }
+
+   public void testGetAdminRoles() throws Exception
+   {
+      try
+      {
+         roleModule.getAdminRoles();
+      }
+      catch (IdentityException e)
+      {
+         fail();
+      }
+
+   }
 }

Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtRoleModuleTestCase.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtRoleModuleTestCase.java	2009-03-04 18:45:19 UTC (rev 12946)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtRoleModuleTestCase.java	2009-03-04 23:17:50 UTC (rev 12947)
@@ -259,4 +259,17 @@
 
 
    }
+
+   public void testGetAdminRoles() throws Exception
+   {
+      try
+      {
+         roleModule.getAdminRoles();
+      }
+      catch (IdentityException e)
+      {
+         fail();
+      }
+
+   }
 }

Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtUserModuleTestCase.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtUserModuleTestCase.java	2009-03-04 18:45:19 UTC (rev 12946)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtUserModuleTestCase.java	2009-03-04 23:17:50 UTC (rev 12947)
@@ -1,28 +1,29 @@
 package org.jboss.portal.test.identity.ldap;
 
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
 import junit.framework.TestSuite;
+
+import org.apache.log4j.Appender;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.SimpleLayout;
+import org.jboss.portal.identity.IdentityConfiguration;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.NoSuchUserException;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.User;
 import org.jboss.portal.identity.UserModule;
-import org.jboss.portal.identity.RoleModule;
-import org.jboss.portal.identity.MembershipModule;
 import org.jboss.portal.identity.UserProfileModule;
-//import org.jboss.portal.identity.IdentityServiceControllerImpl;
-import org.jboss.portal.identity.IdentityContext;
-import org.jboss.portal.identity.IdentityConfiguration;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.identity.Role;
-import org.jboss.portal.identity.NoSuchUserException;
 import org.jboss.portal.identity.ldap.LDAPUserImpl;
 import org.jboss.portal.test.identity.TestServiceLoader;
-import org.apache.log4j.Appender;
-import org.apache.log4j.ConsoleAppender;
-import org.apache.log4j.SimpleLayout;
-import org.apache.log4j.Logger;
-import org.apache.log4j.Level;
 
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Iterator;
-
 /**
  * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
  * @version $Revision: 1.1 $
@@ -194,4 +195,17 @@
 
 
    }
+
+   public void testGetAdminUsers() throws Exception
+   {
+      try
+      {
+         userModule.getAdminUsers();
+      }
+      catch (IdentityException e)
+      {
+         fail();
+      }
+
+   }
 }

Modified: modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/resources/test/config/db-config.xml
===================================================================
--- modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/resources/test/config/db-config.xml	2009-03-04 18:45:19 UTC (rev 12946)
+++ modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/resources/test/config/db-config.xml	2009-03-04 23:17:50 UTC (rev 12947)
@@ -65,5 +65,5 @@
          <config/>
       </module>
    </modules>
-   <options/>
+<!--   <options/>  -->
 </identity-configuration>




More information about the portal-commits mailing list