cancel
Showing results for 
Search instead for 
Did you mean: 

HowTo Bootstrap users?

major_king
Champ in-the-making
Champ in-the-making
Hello everybody,

first i tried to import groups via module bootstrap (see wiki) - works fine. Now i'm trying to import users with the same way, but it doesn't work.

Has anyone an example-configuration for bootstraping user?

Here my error-message:
ERROR [org.alfresco.repo.node.integrity.IntegrityChecker] Found 1 integrity violations:
Invalid property value:
   Node: user://alfrescoUserStore/lustig
   Type: {http://www.alfresco.org/model/user/1.0}authorityContainer
   Property: {http://www.alfresco.org/model/user/1.0}authorityName
   Constraint: The value 'Lustig' is not an allowed authority name: it is an authority of type: USER
ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
org.alfresco.repo.node.integrity.IntegrityException: Found 1 integrity violations:
Invalid property value:
   Node: user://alfrescoUserStore/lustig
   Type: {http://www.alfresco.org/model/user/1.0}authorityContainer
   Property: {http://www.alfresco.org/model/user/1.0}authorityName
   Constraint: The value 'Lustig' is not an allowed authority name: it is an authority of type: USER

And my user.xml (here i tried several things like USER_lusitg, lustig, Lustig, USER, and so on):
<?xml version="1.0" encoding="UTF-8"?>
<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0"
      xmlns:cm="http://www.alfresco.org/model/content/1.0"
      xmlns:sys="http://www.alfresco.org/model/system/1.0"
      xmlns:usr="http://www.alfresco.org/model/user/1.0"
      xmlns:app="http://www.alfresco.org/model/application/1.0">
   <usr:authorityContainer view:childName="usr:lustig">
      <view:aspects>
         <sys:referenceable></sys:referenceable>
      </view:aspects>
      <viewSmiley Tongueroperties>
         <sys:store-protocol>user</sys:store-protocol>
         <cm:name>Peter Lustig</cm:name>
         <sys:node-uuid>lustig</sys:node-uuid>
         <usr:authorityName>Lustig</usr:authorityName>
         <sys:store-identifier>alfrescoUserStore</sys:store-identifier>
      </viewSmiley Tongueroperties>
      <view:associations></view:associations>
   </usr:authorityContainer>
</view:view>

Regards,
christian
2 REPLIES 2

m_vriens
Champ in-the-making
Champ in-the-making
I was able to bootstrap users by inserting their data in both the userspace and the workspace. For this I needed to create two beans:

  <bean id="myproject_bootstrapSpaces" class="org.alfresco.repo.module.ImporterModuleComponent" parent="module.baseComponent">
        <property name="moduleId" value="myproject" />
        <property name="name" value="myproject.bootstrapSpaces" />
        <property name="description" value="Initial data requirements" />
        <property name="sinceVersion" value="0.0.1" />
        <property name="appliesFromVersion" value="0.0.1" />
        <!– property name="executeOnceOnly" value="false" / –>
       
        <property name="importer" ref="spacesBootstrap"/>
        <property name="bootstrapViews">
            <list>
                <props>
                    <prop key="path">/sys:system/sys:people</prop>
                    <prop key="location">alfresco/module/myproject/bootstrap/custom_users_space.xml</prop>
                </props>
            </list>
        </property>
    </bean>

and


   <bean id="myproject_bootstrapUserGroups" class="org.alfresco.repo.module.ImporterModuleComponent" parent="module.baseComponent">
        <property name="moduleId" value="myproject" />
        <property name="name" value="myproject.bootstrapGroups" />
        <property name="description" value="Initial data requirements" />
        <property name="sinceVersion" value="0.0.1" />
        <property name="appliesFromVersion" value="0.0.1" />
        <property name="importer" ref="userBootstrap"/>
        <property name="bootstrapViews">
            <list>
                <props>
                    <prop key="path">/${alfresco_user_store.system_container.childname}/sys:people</prop>
                    <prop key="location">alfresco/module/myproject/bootstrap/custom_users.xml</prop>
                </props>
            </list>
        </property>
    </bean>

the custom_users_space.xml has entries like the following:


<?xml version="1.0" encoding="utf-8"?>
<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0">
    <cm:person xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns=""
               view:childName="cm:myuser">
        <cm:userName>myuser</cm:userName>
        <cm:firstName>First Name</cm:firstName>
        <cm:lastName>Last Name</cm:lastName>
        <cm:presenceUsername></cm:presenceUsername>
        <cm:email>email@address.com</cm:email>
        <cm:organization></cm:organization>
        <cm:homeFolder>workspace://SpacesStore/MY_USERS_HOME</cm:homeFolder>
        <cm:location></cm:location>
        <cm:jobtitle></cm:jobtitle>
        <cm:organizationId></cm:organizationId>
        <cm:sizeQuota>-1</cm:sizeQuota>
        <cm:sizeCurrent>0</cm:sizeCurrent>
    </cm:person>
</view:view>

You have to know in advance the reference of a space to add them to cm:homeFolder. I did this by bootstrapping a space and setting the <sys:node-uuid> of the space to "MY_USERS_HOME" .

The Second XML file is custom_users.xml is

<?xml version="1.0" encoding="UTF-8"?>
<view:view xmlns:view="http://www.alfresco.org/view/repository/1.0"
   xmlns:usr="http://www.alfresco.org/model/user/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0"
   xmlns:sys="http://www.alfresco.org/model/system/1.0" xmlns:wca="http://www.alfresco.org/model/wcmappmodel/1.0"
        xmlns="" view:childName="sys:system">
   <usr:user view:childName="usr:user">
      <view:aspects>
         <sys:referenceable></sys:referenceable>
      </view:aspects>
      <view:properties>
         <usr:accountExpires>false</usr:accountExpires>
         <usr:credentialsExpire>false</usr:credentialsExpire>
         <usr:password>3dbde697d71690a769204beb12283678</usr:password>
         <usr:accountLocked>false</usr:accountLocked>
         <usr:username>myuser</usr:username>
         <usr:salt>
            <view:value view:isNull="true"></view:value>
         </usr:salt>
         <usr:enabled>true</usr:enabled>
      </view:properties>
   </usr:user>
</view:view>

<usrSmiley Tongueassword> contains the hash value for password "123".

The above will load a user with login "myuser" and password "123".  Smiley Happy

Hope this is of use.

Sourcesence.com - European Alfresco Partner - Italy, UK, Netherlands

nikolina
Champ in-the-making
Champ in-the-making
Hi m.vriens,

First of all, I would like to thank you for your answer, it was very useful Smiley Happy

My question is how to create MY_USERS_HOME (custom home) using bootstrap? I suppose that i can do that by creating an xml file where my custom space would be defined, but I don't know how it should look like.

Instead of:
<cm:homeFolder>workspace://SpacesStore/MY_USERS_HOME</cm:homeFolder>

I put
<cm:homeFolder>/${spaces.company_home.childname}/${spaces.user_homes.childname}</cm:homeFolder>
<cm:defaultHomeFolderPath>/Company Home/User Homes/</cm:defaultHomeFolderPath>
and it worked fine, but i would like to be able to create my custom home space.

Thanks in advance,

nikolina