Author: dimuthul
Date: Mon Jan  7 02:13:38 2008
New Revision: 11931

Log:

Fixing issue COMMONS-48



Added:
   
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/readwrite/create_db.sql
   trunk/commons/usermanager/modules/core/src/test/resources/org/
   trunk/commons/usermanager/modules/core/src/test/resources/org/wso2/
   
trunk/commons/usermanager/modules/core/src/test/resources/org/wso2/usermanager/
   
trunk/commons/usermanager/modules/core/src/test/resources/org/wso2/usermanager/resources.properties
Removed:
   trunk/commons/usermanager/modules/core/src/main/resources/
Modified:
   trunk/commons/usermanager/modules/core/pom.xml
   
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/acl/realm/AuthorizingRealmConfig.java
   
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/readwrite/DefaultUserStoreAdmin.java
   
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/resources.properties
   trunk/commons/usermanager/pom.xml

Modified: trunk/commons/usermanager/modules/core/pom.xml
==============================================================================
--- trunk/commons/usermanager/modules/core/pom.xml      (original)
+++ trunk/commons/usermanager/modules/core/pom.xml      Mon Jan  7 02:13:38 2008
@@ -17,15 +17,7 @@
     <name>User Manager Core</name>
 
     <build>
-       <resources>
-            <resource>
-                <directory>src/main/java</directory>
-                <includes>
-                    
<include>org/wso2/usermanager/resources.properties</include>
-                </includes>
-            </resource>
-        </resources>
-        <plugins>
+       <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>

Modified: 
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/acl/realm/AuthorizingRealmConfig.java
==============================================================================
--- 
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/acl/realm/AuthorizingRealmConfig.java
     (original)
+++ 
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/acl/realm/AuthorizingRealmConfig.java
     Mon Jan  7 02:13:38 2008
@@ -32,4 +32,38 @@
         this.authenticatedUserName = authenticatedUserName;
     }
 
+    /**
+     * Users with Admin Role cannot be deleted, edited, read by other normal 
users.
+     * If a user has the Admin Role he will be authorized to do anything. 
+     * i.e. isUserAuthorized() method will return true to every 
resource/action.  
+     * Admin role users can be edited/deleted and read by other admin role 
users only.
+     * @param adminRoleName
+     * @param isRemovable
+     */
+    public void enableAdminRole(String adminRoleName) {
+
+    }
+    
+    /**
+     * Current user permission on himself when editing/reading data
+     * @param readable - Let current user read his properties
+     * @param editable - Let current user edit his properties/password
+     */
+    public void enablePermissionOnCurrentUser(boolean readable,
+            boolean editable) {
+
+    }
+    
+    /**
+     * Enable Role relative permissions when add/edit/deleting users.
+     * 
+     * @param readOthersInRole - If the authorizedUser has the same role as 
the questioning user - allow him to read the questioning user.
+     * @param editOthersInRole - If the authorizedUser has the same role as 
the questioning user - allow him to edit the questioning user.
+     * @param removeOthersInRole - If the authorizedUser has the same role as 
the questioning user - allow him to edit the questioning user.
+     */
+    public void enablePermissionOnCurrentRole(boolean readOthersInRole,
+            boolean editOthersInRole, boolean removeOthersInRole) {
+
+    }
+
 }

Modified: 
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/readwrite/DefaultUserStoreAdmin.java
==============================================================================
--- 
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/readwrite/DefaultUserStoreAdmin.java
      (original)
+++ 
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/readwrite/DefaultUserStoreAdmin.java
      Mon Jan  7 02:13:38 2008
@@ -33,10 +33,19 @@
 
     public void addUser(String userName, Object credential)
             throws UserManagerException {
+        
+        if(userName == null || credential == null){
+            throw new UserManagerException("nullData");
+        }
+        
         if (!(credential instanceof String)) {
-            throw new UserManagerException("Credential type not support");
+            throw new UserManagerException("credentialTypeNotSupport");
         }
-
+        
+        if(userName.trim().length() == 0){
+            throw new UserManagerException("nullUser");
+        }
+        
         Connection dbConnection = null;
         try {
             dbConnection = dataSource.getConnection();

Added: 
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/readwrite/create_db.sql
==============================================================================
--- (empty file)
+++ 
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/readwrite/create_db.sql
   Mon Jan  7 02:13:38 2008
@@ -0,0 +1,8 @@
+CREATE TABLE UM_USERS (ID VARCHAR(255), USER_NAME VARCHAR(255) NOT NULL, 
PASSWORD VARCHAR(255) NOT NULL, PRIMARY KEY (ID), UNIQUE(USER_NAME));
+CREATE TABLE UM_USER_ATTRIBUTES (ID VARCHAR(255), ATTR_NAME VARCHAR(255) NOT 
NULL, ATTR_VALUE VARCHAR(255), USER_ID VARCHAR(255), FOREIGN KEY (USER_ID) 
REFERENCES UM_USERS(ID) ON DELETE CASCADE, PRIMARY KEY (ID));
+CREATE TABLE UM_ROLES (ID VARCHAR(255), ROLE_NAME VARCHAR(255) NOT NULL, 
PRIMARY KEY (ID), UNIQUE(ROLE_NAME));
+CREATE TABLE UM_ROLE_ATTRIBUTES (ID VARCHAR(255), ATTR_NAME VARCHAR(255) NOT 
NULL, ATTR_VALUE VARCHAR(255), ROLE_ID VARCHAR(255), FOREIGN KEY (ROLE_ID) 
REFERENCES UM_ROLES(ID) ON DELETE CASCADE, PRIMARY KEY (ID));
+CREATE TABLE UM_PERMISSIONS (ID VARCHAR(255), RESOURCE_ID VARCHAR(255) NOT 
NULL, ACTION VARCHAR(255) NOT NULL, PRIMARY KEY (ID));
+CREATE TABLE UM_ROLE_PERMISSIONS (ID VARCHAR(255), PERMISSION_ID VARCHAR(255) 
NOT NULL, ROLE_ID VARCHAR(255) NOT NULL, IS_ALLOWED SMALLINT NOT NULL, UNIQUE 
(PERMISSION_ID, ROLE_ID), FOREIGN KEY (PERMISSION_ID) REFERENCES 
UM_PERMISSIONS(ID) ON DELETE  CASCADE, FOREIGN KEY (ROLE_ID) REFERENCES 
UM_ROLES(ID) ON DELETE CASCADE, PRIMARY KEY (ID));
+CREATE TABLE UM_USER_PERMISSIONS (ID VARCHAR(255), PERMISSION_ID VARCHAR(255) 
NOT NULL, USER_ID VARCHAR(255) NOT NULL, IS_ALLOWED SMALLINT NOT NULL, UNIQUE 
(PERMISSION_ID, USER_ID), FOREIGN KEY (PERMISSION_ID) REFERENCES 
UM_PERMISSIONS(ID) ON DELETE CASCADE, FOREIGN KEY (USER_ID) REFERENCES 
UM_USERS(ID) ON DELETE CASCADE, PRIMARY KEY (ID));
+CREATE TABLE UM_USER_ROLES (ID VARCHAR(255), ROLE_ID VARCHAR(255), USER_ID 
VARCHAR(255), FOREIGN KEY (ROLE_ID) REFERENCES UM_ROLES(ID) ON DELETE CASCADE, 
FOREIGN KEY (USER_ID) REFERENCES UM_USERS(ID) ON DELETE CASCADE, PRIMARY KEY 
(ID));
\ No newline at end of file

Modified: 
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/resources.properties
==============================================================================
--- 
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/resources.properties
      (original)
+++ 
trunk/commons/usermanager/modules/core/src/main/java/org/wso2/usermanager/resources.properties
      Mon Jan  7 02:13:38 2008
@@ -1,3 +1,4 @@
+credentialTypeNotSupport = Credential not Supported
 duplicateUser = User name already exists. Please select another user name!
 exceptionOnConnectionOpen = Error occuered while connecting to Userstore
 sqlFileNotFound = SQL file not found for Default Realm

Added: 
trunk/commons/usermanager/modules/core/src/test/resources/org/wso2/usermanager/resources.properties
==============================================================================
--- (empty file)
+++ 
trunk/commons/usermanager/modules/core/src/test/resources/org/wso2/usermanager/resources.properties
 Mon Jan  7 02:13:38 2008
@@ -0,0 +1,42 @@
+duplicateUser = User name already exists. Please select another user name!
+exceptionOnConnectionOpen = Error occuered while connecting to Userstore
+sqlFileNotFound = SQL file not found for Default Realm
+errorModifyingUserStore = Error modifying the database
+errorReadingFromUserStore = Error reading users from database
+nullData = Invalid or Null data provided
+nullUser = Invalid user name provided
+nullRole = Invalid role name provided
+beanMappingNotfound = AuthenticationProvider Bean Mapping must be provided in 
file
+nullAuthProvider = AuthenticationProvider id must be present
+unsupportedCredential = Credential type unsupported
+initVerifier = Please call init() method in the verifier
+sendingMailProblems = Problems encountered while trying to send mail
+error= Error
+pendingAdd = Error occured while adding you. Please try again.
+invalidOrExpired = Invalid or expired
+exceptionOnAuthenticate = Exception on Authenticate
+getProperties = Getting properties of user
+unknownUserNameFormatInLDAP= Unknown format of Users in LDAP. We expect 
boo=username : object.class
+errorOpeningLDAP = Error opening connection to the LDAP directory. Please 
check connection name, password and url.
+bindFailedBecauseAuthenticationException = Failed to Authenticate because of 
bind failure
+errorInitializingConnection = Error Initializing Connection.
+copyAuthorizationFailedPermissionExist = Copying Authorizations failed, 
because permissions exist for the destination Resource
+errorCopyingAuthorizations = Error copying authorizations
+errorCreatingPasswordDigest = Error creating password digest
+unAuthorized = User is unauthorized to perform the action
+authorizerNullatAuthorizer = Authorizer is null at AuthorizingRealm. This 
cannot be
+errorClosingConnection = Error closing connection!
+oldPasswordIncorrect = Cannot update password of user. Invalid user name 
password!
+nullRealm = Null Realm not permitted.
+verifierUserDatabaseInit = Cannot create the Email Verifier Database
+#validation errors
+jdbcConfigValidation = UserTable, UserNameColumn, UserCredentialColumn, 
ConnectionURL cannot be null or empty
+acegiConfigValidation = AuthProviderId, AuthenticationProviderBeanMappingFile 
cannot be null or empty
+ldapConfigValidation = ConnectionName, ConnectionPass, ConnectionUrl, 
UserPattern cannot be null or empty
+#only log messages
+getGenericUserByPattern = Searching user by generic pattern
+validatingCredentials = Validating users
+dbCreationNotSupported = Database creation not supported for this driver
+nullConnection = Cannot get connection. Contact Administrator
+unableToResetPool = Unable to reset realm. There are people holding instances 
of PoolManager
+

Modified: trunk/commons/usermanager/pom.xml
==============================================================================
--- trunk/commons/usermanager/pom.xml   (original)
+++ trunk/commons/usermanager/pom.xml   Mon Jan  7 02:13:38 2008
@@ -4,6 +4,7 @@
 
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.wso2.commons.usermanager</groupId>
+    <name>WSO2 UserManager</name>
     <packaging>pom</packaging>
     <version>SNAPSHOT</version>
     <artifactId>usermanager-pom</artifactId>

_______________________________________________
Commons-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/commons-dev

Reply via email to