cancel
Showing results for 
Search instead for 
Did you mean: 

How to create users in alfresco...

k4sourabh
Champ in-the-making
Champ in-the-making
1. How to create user in alfresco using Alfresco Java Api or JCR.

2. How to create groups and assign user to a group using Alfresco Java Api or JCR.


PLease reply..

Thanks in advance.
22 REPLIES 22

fracat71
Champ on-the-rise
Champ on-the-rise
Hi all,
i find something useful inside http://forums.alfresco.com/en/viewtopic.php?f=4&t=27217.
But now have i to change everything?
Replace AuthenticationService with MutableAuthenticationService?

Thanks

mrogers
Star Contributor
Star Contributor
No.   Don't replace it.  

Check that your instance of the authentication service is a MutableAuthenticationService and cast it.

pshark
Champ in-the-making
Champ in-the-making
Hey guys, I noticed this thread is a little old, but I had a different issue creating users with code similar to what is posted here. I'm using 4.0d Community edition of Alfresco.

I'm trying to create a user on the fly when a user logs in to the system. Here is a snippet of the code I added to the function authenticateImpl in the class org.alfresco.repo.security.authentication.AuthenticationComponentImpl:

QName userVeto = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "UserVeto");
((TransactionServiceImpl)getTransactionService()).setAllowWrite(true, userVeto);
boolean testW = ((TransactionServiceImpl)getTransactionService()).isReadOnly();
boolean testW2 = ((TransactionServiceImpl)getTransactionService()).getAllowWrite();
((PersonServiceImpl)getPersonService()).setTransactionService((TransactionServiceImpl)getTransactionService());
getPersonService().createPerson(properties);

The var testW is false, testW2 is true as expected. The createPerson function is throwing the error:
org.alfresco.service.transaction.ReadOnlyServerException: 02290094 Access Denied.  The system is currently in read-only mode.

Is there something else I need to do to authenticate / enable write access? I added the code to modify the transaction service, but it doesn't appear to have done anything. The error is originating in the function newNode in the class org.alfresco.repo.domain.node.AbstractNodeDAOImpl at line 1066.
Note that I do not have the matching source code for this version of the class, so i can't say what is happening at this line. If someone could tell me what source code revision corresponds to the 4.0d community release, that might help as well.

Mainly, I'm hoping there is some way to perform an authentication / enable writing to the directory.