AnsweredAssumed Answered

Failed to create a user using users.xml given by alfresco

Question asked by srinivasan on Jul 17, 2006
Hi Developers,

I am trying to create a user, with the help of user.xml which is provied by alfresco and i customized the importcomponenttest.java the following files are given below.


package org.alfresco.sample;

import java.io.InputStream;
import java.io.InputStreamReader;

import org.alfresco.repo.importer.ImportTimerProgress;
import org.alfresco.repo.importer.ImporterBootstrap;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.view.ImporterService;
import org.alfresco.service.cmr.view.Location;
import org.alfresco.util.BaseSpringTest;
import org.alfresco.util.debug.NodeStoreInspector;


public class ImporterComponentTest extends BaseSpringTest
{
    private ImporterService importerService;
    private ImporterBootstrap importerBootstrap;
    private NodeService nodeService;
    private StoreRef storeRef;
    private AuthenticationComponent authenticationComponent;

   
    @Override
    protected void onSetUpInTransaction() throws Exception
    {
        nodeService = (NodeService)applicationContext.getBean(ServiceRegistry.NODE_SERVICE.getLocalName());
        importerService = (ImporterService)applicationContext.getBean(ServiceRegistry.IMPORTER_SERVICE.getLocalName());
       
        //importerBootstrap = (ImporterBootstrap)applicationContext.getBean("spacesBootstrap");
        importerBootstrap = (ImporterBootstrap)applicationContext.getBean("userBootstrap");
       
        this.authenticationComponent = (AuthenticationComponent)this.applicationContext.getBean("authenticationComponent");
       
        //this.authenticationComponent.setSystemUserAsCurrentUser();
        this.authenticationComponent.setCurrentUser("admin");
       
        // Create the store
        this.storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "SpaceStore");
    }
   
    @Override
    protected void onTearDownInTransaction() throws Exception
    {
        authenticationComponent.clearCurrentSecurityContext();
        super.onTearDownInTransaction();
    }
   
   
    public void testImport()
        throws Exception
    {
        InputStream test = getClass().getClassLoader().getResourceAsStream("alfresco/extension/sampleUsers/users.xml");
        InputStreamReader testReader = new InputStreamReader(test, "UTF-8");
        Location location = new Location(storeRef);
        importerService.importView(testReader, location, null, new ImportTimerProgress());
        System.out.println(NodeStoreInspector.dumpNodeStore(nodeService, storeRef));
    }
   
    public void testBootstrap()
    {
        StoreRef bootstrapStoreRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
        importerBootstrap.setStoreUrl(bootstrapStoreRef.toString());
        importerBootstrap.bootstrap();
        //authenticationComponent.setSystemUserAsCurrentUser();
        authenticationComponent.setCurrentUser("admin");
        System.out.println(NodeStoreInspector.dumpNodeStore(nodeService, bootstrapStoreRef));
    }
}


user.xml file

<?xml version="1.0" encoding="UTF-8"?>
<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:alf="http://www.alfresco.org" xmlns:d="http://www.alfresco.org/model/dictionary/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:act="http://www.alfresco.org/model/action/1.0" xmlns:rule="http://www.alfresco.org/model/rule/1.0" xmlns:fm="http://www.alfresco.org/model/forum/1.0" xmlns:app="http://www.alfresco.org/model/application/1.0" xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:ver="http://www.alfresco.org/model/versionstore/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns="">
  <usr:user view:childName="usr:user">
    <view:properties>
      <usr:username>jeff</usr:username>
      <usr:password>e0fba38268d0ec66ef1cb452d5885e53</usr:password>  <!– default password of 'abc' –>
      <usr:accountExpires>false</usr:accountExpires>
      <usr:credentialsExpire>false</usr:credentialsExpire>
      <usr:accountLocked>false</usr:accountLocked>
      <usr:enabled>true</usr:enabled>
    </view:properties>
  </usr:user>
  <usr:user view:childName="usr:user">
    <view:properties>
      <usr:username>muda</usr:username>
      <usr:password>e0fba38268d0ec66ef1cb452d5885e53</usr:password>  <!– default password of 'abc' –>
      <usr:accountExpires>false</usr:accountExpires>
      <usr:credentialsExpire>false</usr:credentialsExpire>
      <usr:accountLocked>false</usr:accountLocked>
      <usr:enabled>true</usr:enabled>
    </view:properties>
  </usr:user>
 
  </view:view>

Result i got after the execution:

Jul 17, 2006 12:12:14 PM net.sf.joott.uno.UnoConnection connect
INFO: connecting using "socket,host=localhost,port=8100,tcpNoDelay=1"…
Jul 17, 2006 12:12:15 PM net.sf.joott.uno.UnoConnection connect
SEVERE: connection failed: com.sun.star.connection.NoConnectException: java.net.ConnectException: Connection refused: connect
Jul 17, 2006 12:12:15 PM net.sf.joott.uno.UnoConnection connect
INFO: connecting using "socket,host=localhost,port=8100,tcpNoDelay=1"…
Jul 17, 2006 12:12:16 PM net.sf.joott.uno.UnoConnection connect
SEVERE: connection failed: com.sun.star.connection.NoConnectException: java.net.ConnectException: Connection refused: connect
12:12:16,890 DEBUG [repo.importer.ImporterBootstrap] Store exists - bootstrap ignored: user://alfrescoUserStore
12:12:16,906 DEBUG [repo.importer.ImporterBootstrap] Store exists - bootstrap ignored: system://system
12:12:16,921 DEBUG [repo.importer.ImporterBootstrap] Store exists - bootstrap ignored: workspace://lightWeightVersionStore
12:12:16,921 DEBUG [repo.importer.ImporterBootstrap] Store exists - bootstrap ignored: archive://SpacesStore
12:12:16,937 DEBUG [repo.importer.ImporterBootstrap] Store exists - bootstrap ignored: workspace://SpacesStore
node: 64a9fda8-155f-11db-8acb-95a545eccae1 (store_root, aspect_root)
   @store-protocol = workspace
   @name = 64a9fda8-155f-11db-8acb-95a545eccae1
   @node-uuid = 64a9fda8-155f-11db-8acb-95a545eccae1
   @store-identifier = SpaceStore
   -> {http://www.alfresco.org/model/user/1.0}user ({http://www.alfresco.org/model/user/1.0}user)
      node: 64c1cb6a-155f-11db-8acb-95a545eccae1 (user, referenceable)
         @accountExpires = false
         @password = e0fba38268d0ec66ef1cb452d5885e53
         @credentialsExpire = false
         @node-uuid = 64c1cb6a-155f-11db-8acb-95a545eccae1
         @accountLocked = false
         @store-protocol = workspace
         @name = 64c1cb6a-155f-11db-8acb-95a545eccae1
         @username = jeff
         @store-identifier = SpaceStore
         @enabled = true
   -> {http://www.alfresco.org/model/user/1.0}user ({http://www.alfresco.org/model/user/1.0}user)
      node: 64c6865b-155f-11db-8acb-95a545eccae1 (user, referenceable)
         @accountExpires = false
         @password = e0fba38268d0ec66ef1cb452d5885e53
         @credentialsExpire = false
         @node-uuid = 64c6865b-155f-11db-8acb-95a545eccae1
         @accountLocked = false
         @store-protocol = workspace
         @name = 64c6865b-155f-11db-8acb-95a545eccae1
         @username = muda
         @store-identifier = SpaceStore
         @enabled = true

12:12:19,703 DEBUG [repo.importer.ImporterBootstrap] Created store: workspace://Test_1153118539671
12:12:19,718 DEBUG [repo.importer.ImporterBootstrap] Importing alfresco/bootstrap/alfrescoUserStore.xml
12:12:19,718 DEBUG [repo.importer.ImporterBootstrap] Import started at Mon Jul 17 12:12:19 GMT+05:30 2006 (1153118539718)
12:12:19,843 DEBUG [repo.importer.ImporterBootstrap] Import completed at Mon Jul 17 12:12:19 GMT+05:30 2006 (1153118539843)
12:12:19,843 DEBUG [repo.importer.ImporterBootstrap] Import duration: 125 ms (Note: excluding commit time)
12:12:19,843 DEBUG [repo.importer.ImporterBootstrap]  Nodes created: 3
12:12:19,843 DEBUG [repo.importer.ImporterBootstrap]  Nodes linked: 0
12:12:19,843 DEBUG [repo.importer.ImporterBootstrap]  Aspects Added: 0
12:12:19,843 DEBUG [repo.importer.ImporterBootstrap]  Properties set: 6
12:12:19,843 DEBUG [repo.importer.ImporterBootstrap]  Content set: 0
12:12:19,843 DEBUG [repo.importer.ImporterBootstrap]  Permissions set: 0
12:12:19,843 DEBUG [repo.importer.ImporterBootstrap] Importing alfresco/extension/sampleUsers/users.xml
12:12:19,859 DEBUG [repo.importer.ImporterBootstrap] Import started at Mon Jul 17 12:12:19 GMT+05:30 2006 (1153118539859)
12:12:19,890 DEBUG [repo.importer.ImporterBootstrap] Import completed at Mon Jul 17 12:12:19 GMT+05:30 2006 (1153118539890)
12:12:19,890 DEBUG [repo.importer.ImporterBootstrap] Import duration: 31 ms (Note: excluding commit time)
12:12:19,890 DEBUG [repo.importer.ImporterBootstrap]  Nodes created: 2
12:12:19,890 DEBUG [repo.importer.ImporterBootstrap]  Nodes linked: 0
12:12:19,890 DEBUG [repo.importer.ImporterBootstrap]  Aspects Added: 0
12:12:19,890 DEBUG [repo.importer.ImporterBootstrap]  Properties set: 12
12:12:19,890 DEBUG [repo.importer.ImporterBootstrap]  Content set: 0
12:12:19,890 DEBUG [repo.importer.ImporterBootstrap]  Permissions set: 0
node: 64ecabff-155f-11db-8acb-95a545eccae1 (store_root, aspect_root)
   @store-protocol = workspace
   @name = 64ecabff-155f-11db-8acb-95a545eccae1
   @node-uuid = 64ecabff-155f-11db-8acb-95a545eccae1
   @store-identifier = Test_1153118539671
   -> {http://www.alfresco.org/model/system/1.0}system ({http://www.alfresco.org/model/system/1.0}system)
      node: 64f166f1-155f-11db-8acb-95a545eccae1 (container, referenceable, ownable)
         @store-protocol = workspace
         @owner = System
         @node-uuid = 64f166f1-155f-11db-8acb-95a545eccae1
         @name = 64f166f1-155f-11db-8acb-95a545eccae1
         @store-identifier = Test_1153118539671
         -> {http://www.alfresco.org/model/system/1.0}people ({http://www.alfresco.org/model/system/1.0}people)
            node: 64fd4dd2-155f-11db-8acb-95a545eccae1 (container, referenceable, ownable)
               @store-protocol = workspace
               @owner = System
               @node-uuid = 64fd4dd2-155f-11db-8acb-95a545eccae1
               @name = 64fd4dd2-155f-11db-8acb-95a545eccae1
               @store-identifier = Test_1153118539671
               -> {http://www.alfresco.org/model/user/1.0}user ({http://www.alfresco.org/model/user/1.0}user)
                  node: 64ffbed3-155f-11db-8acb-95a545eccae1 (user, referenceable, ownable)
                     @accountExpires = false
                     @owner = System
                     @password = 209c6174da490caeb422f3fa5a7ae634
                     @credentialsExpire = false
                     @node-uuid = 64ffbed3-155f-11db-8acb-95a545eccae1
                     @accountLocked = false
                     @store-protocol = workspace
                     @name = 64ffbed3-155f-11db-8acb-95a545eccae1
                     @username = admin
                     @store-identifier = Test_1153118539671
                     @enabled = true
               -> {http://www.alfresco.org/model/user/1.0}user ({http://www.alfresco.org/model/user/1.0}user)
                  node: 6506eac4-155f-11db-8acb-95a545eccae1 (user, referenceable, ownable)
                     @accountExpires = false
                     @owner = System
                     @password = e0fba38268d0ec66ef1cb452d5885e53
                     @credentialsExpire = false
                     @node-uuid = 6506eac4-155f-11db-8acb-95a545eccae1
                     @accountLocked = false
                     @store-protocol = workspace
                     @name = 6506eac4-155f-11db-8acb-95a545eccae1
                     @username = jeff
                     @store-identifier = Test_1153118539671
                     @enabled = true
               -> {http://www.alfresco.org/model/user/1.0}user ({http://www.alfresco.org/model/user/1.0}user)
                  node: 65095bc5-155f-11db-8acb-95a545eccae1 (user, referenceable, ownable)
                     @accountExpires = false
                     @owner = System
                     @password = e0fba38268d0ec66ef1cb452d5885e53
                     @credentialsExpire = false
                     @node-uuid = 65095bc5-155f-11db-8acb-95a545eccae1
                     @accountLocked = false
                     @store-protocol = workspace
                     @name = 65095bc5-155f-11db-8acb-95a545eccae1
                     @username = muda
                     @store-identifier = Test_1153118539671
                     @enabled = true

After the execution i logged into webclient as admin,

but i did find the user jeff and muda.

Do you know why?

or where i can find the user.

Can you describe about the system user?

is this possible to login as system in webclient? i am tried but not able to login as system.

Outcomes