RM-771 rmadmin user has no first or last name set

* The change includes modifying RMv2RMAdminUserPatch.java to include the default first name and last name on RM admin user creation.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@53483 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Craig Tan
2013-08-01 04:52:39 +00:00
parent 2bd6e46887
commit 19cbdb8018
5 changed files with 58 additions and 2 deletions

View File

@@ -28,6 +28,8 @@ cache.writersSharedCache.maxItems=10000
#
bootstrap.rmadmin.name=rmadmin
bootstrap.rmadmin.pwd=rmadmin
bootstrap.rmadmin.firstName=Records Management
bootstrap.rmadmin.lastName=Administrator
#
# Indicates whether RM rules will be run as RM Admin or not by default

View File

@@ -1188,6 +1188,8 @@
<bean id="filePlanAuthenticationService"
class="org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationServiceImpl">
<property name="rmAdminUserName" value="${bootstrap.rmadmin.name}" />
<property name="rmAdminFirstName" value="${bootstrap.rmadmin.firstName}" />
<property name="rmAdminLastName" value="${bootstrap.rmadmin.lastName}" />
</bean>
<bean id="FilePlanAuthenticationService" class="org.springframework.aop.framework.ProxyFactoryBean">

View File

@@ -124,6 +124,9 @@ public class RMv2RMAdminUserPatch extends ModulePatchComponent implements BeanNa
}
String user = filePlanAuthenticationService.getRmAdminUserName();
String firstName = filePlanAuthenticationService.getRmAdminFirstName();
String lastName = filePlanAuthenticationService.getRmAdminLastName();
if (authenticationService.authenticationExists(user) == false)
{
if (logger.isDebugEnabled() == true)
@@ -134,6 +137,8 @@ public class RMv2RMAdminUserPatch extends ModulePatchComponent implements BeanNa
authenticationService.createAuthentication(user, password.toCharArray());
Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
properties.put(ContentModel.PROP_USERNAME, user);
properties.put(ContentModel.PROP_FIRSTNAME, firstName);
properties.put(ContentModel.PROP_LASTNAME, lastName);
personService.createPerson(properties);
if (logger.isDebugEnabled() == true)
@@ -152,6 +157,5 @@ public class RMv2RMAdminUserPatch extends ModulePatchComponent implements BeanNa
logger.debug(" ... RMv2RMAdminUserPatch complete");
}
}
}
}

View File

@@ -33,6 +33,16 @@ public interface FilePlanAuthenticationService
*/
String getRmAdminUserName();
/**
* @return rm admin first name
*/
String getRmAdminFirstName();
/**
* @return rm admin last name
*/
String getRmAdminLastName();
/**
* Run provided work as the global rm admin user.
*

View File

@@ -30,9 +30,13 @@ public class FilePlanAuthenticationServiceImpl implements FilePlanAuthentication
/** Default rm admin user values */
public static final String DEFAULT_RM_ADMIN_USER = "rmadmin";
public static final String DEFAULT_RM_ADMIN_PWD = "rmadmin";
public static final String DEFAULT_RM_ADMIN_FIRST_NAME = "Records Management";
public static final String DEFAULT_RM_ADMIN_LAST_NAME = "Administrator";
private String rmAdminUserName = DEFAULT_RM_ADMIN_USER;
private String rmAdminFirstName = DEFAULT_RM_ADMIN_FIRST_NAME;
private String rmAdminLastName = DEFAULT_RM_ADMIN_LAST_NAME;
/**
* @param rmAdminUserName rm admin user name
*/
@@ -50,6 +54,40 @@ public class FilePlanAuthenticationServiceImpl implements FilePlanAuthentication
return rmAdminUserName;
}
/**
* @param rmAdminFirstName rm admin first name
*/
public void setRmAdminFirstName(String rmAdminFirstName)
{
this.rmAdminFirstName = rmAdminFirstName;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService#getRMAdminFirstName()
*/
@Override
public String getRmAdminFirstName()
{
return rmAdminFirstName;
}
/**
* @param rmAdminLastName rm admin last name
*/
public void setRmAdminLastName(String rmAdminLastName)
{
this.rmAdminLastName = rmAdminLastName;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService#getRMAdminLastName()
*/
@Override
public String getRmAdminLastName()
{
return rmAdminLastName;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService#runAsRMAdmin(org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork)
*/