08-03-2009 11:58 AM
// Run as System user to create new user
NodeRef newPerson = AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<NodeRef>() {
public NodeRef doWork() throws Exception {
// create the ACEGI Authentication instance for the new user
authenticationService.createAuthentication(userName, password.toCharArray());
//mutableAuthenticationDao.createUser(userName, password.toCharArray());
// create properties for Person
PropertyMap props = new PropertyMap();
props.put(ContentModel.PROP_USERNAME, userName);
props.put(ContentModel.PROP_FIRSTNAME, firstName);
props.put(ContentModel.PROP_LASTNAME, lastName);
props.put(ContentModel.PROP_EMAIL, email);
props.put(ContentModel.PROP_ORGANIZATION, account.getAccountName());
// create the node to represent the Person
NodeRef newPerson = personService.createPerson(props);
// ensure the user can access their own Person object
permissionService.setPermission(newPerson, userName, permissionService.getAllPermission(), true);
return newPerson;
}
}, AuthenticationUtil.getSystemUserName());
08-03-2009 12:02 PM
<bean id="MyServiceImpl" class="com.test.alfresco.services.MyServiceImpl" init-method="init">
<property name="serviceRegistry" ref="ServiceRegistry"/>
<property name="nodeService" ref="NodeService"/>
<property name="searchService" ref="SearchService"/>
<property name="namespaceService" ref="NamespaceService"/>
<property name="permissionService" ref="PermissionService" />
<property name="personService" ref="personService"/>
<property name="authorityService" ref="authorityService"/>
<property name="authenticationService" ref="authenticationService"/>
<property name="mutableAuthenticationDao" ref="authenticationDao"/>
<property name="dictionaryService" ref="DictionaryService"/>
<property name="tenantAdminService" ref="tenantAdminService"/>
<property name="transactionHelper" ref="retryingTransactionHelper"/>
<property name="mailService" ref="mailService"/>
</bean>
08-03-2009 01:08 PM
08-03-2009 02:21 PM
08-03-2009 02:39 PM
08-04-2009 05:59 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.