cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Person Properties in User Profile

michaelsever
Champ in-the-making
Champ in-the-making
In the Alfresco Explorer, how can I add a custom property to the Person Properties Screen? I want to add a field to capture if an user is an employee or contractor when creating a new user.
5 REPLIES 5

zaizi
Champ in-the-making
Champ in-the-making
1. Define a custom aspect to store the values.
2. Update and inject your own person service to add this aspect and store / read the additional custom values to the person object.
3. Make the necessary UI changes to make the properties editable.

prateekgoyal
Champ in-the-making
Champ in-the-making
Hey,
can you please elaborate the steps that you have mentioned above, actually i have defined a custom property in contentModel.xml but dont know how to move ahead to add custom property to a user.
Thanks,

invictus9
Champ in-the-making
Champ in-the-making
Hey,
can you please elaborate the steps that you have mentioned above, actually i have defined a custom property in contentModel.xml but dont know how to move ahead to add custom property to a user.
Thanks,

1) Don't change contentModel.xml –  this is a maintenance bug waiting to happen.

2) Create an aspect containing the custom fields.

3) Force the aspect to be added to Person nodes when they are created (I don't know how this is done). Add the aspect to all existing Person nodes (a simple script will do).

4) Change the display of Person to show the contents of the new aspect (I don't know how this is done).

vasjuk
Champ in-the-making
Champ in-the-making
Hey

I'm try do add same custom properties as show http://forums.alfresco.com/en/viewtopic.php?f=5&t=20970

My custom content model
<?xml version="1.0" encoding="UTF-8"?><!– Definition of Substitution Model –><model name="sub:substitution" xmlns="http://www.alfresco.org/model/dictionary/1.0">   <!– Optional meta-data about the model –>   <description>Substitution Model</description>   <author>Sergei V. Vasjuk</author>   <version>1.0</version>   <!– Imports are required to allow references to definitions in other models –>   <imports>      <!– Import Alfresco Dictionary Definitions –>      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>      <!– Import Alfresco Content Domain Model Definitions –>      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>   </imports>   <!– Introduction of new namespaces defined by this model –>   <namespaces>      <namespace uri="http://www.alfresco.com/model/substitution/1.0" prefix="sub"/>   </namespaces>    <aspects>      <!– Definition of new Content Aspect: Substitution User –>      <aspect name="sub:substitutionable">         <title>User Substitutionable</title>         <properties>            <property name="sub:userRef">               <type>d:text</type>            </property>         </properties>      </aspect>   </aspects></model>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

sub-model-context.xml

<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'><beans>    <!– Registration of new models –>    <bean id="extension.sub.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">        <property name="models">            <list>                <value>alfresco/extension/sub-model.xml</value>            </list>        </property>    </bean>     <bean id="extension.sub.resourceBundle" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">       <property name="resourceBundles">          <list>             <value>alfresco.messages.substitution</value>          </list>       </property>    </bean></beans>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Copy tomcat/webapps/alfresco/WEB-INF/classes/alfresco/model/contentModel.xml to tomcat/shared/classes/alfresco/extension/model/customContentModel.xml and make same change

<import uri="//www.alfresco.com/model/substitution/1.0" prefix="sub"/>…..      <type name="cm:person">         <title>Person</title>         <parent>cm:authority</parent>         <properties>            <!– The tokenisation set here is ignored - it is fixed for this type –>            <!– This is so you can not break person lookup –>            <property name="cm:userName">               <type>d:text</type>               <mandatory>true</mandatory>               <constraints>                  <constraint ref="cm:userNameConstraint" />               </constraints>            </property>            <property name="cm:homeFolder">               <type>d:noderef</type>               <mandatory>true</mandatory>            </property>             <property name="cm:firstName">               <type>d:text</type>               <mandatory>true</mandatory>            </property>            <property name="cm:lastName">               <type>d:text</type>               <mandatory>true</mandatory>            </property>            <property name="cm:middleName">               <type>d:text</type>            </property>            <property name="cm:email">               <type>d:text</type>            </property>            <property name="cm:organizationId">               <type>d:text</type>            </property>            <property name="cm:homeFolderProvider">               <type>d:text</type>            </property>            <property name="cm:defaultHomeFolderPath">               <type>d:text</type>            </property>            <property name="cm:presenceProvider">               <type>d:text</type>            </property>            <property name="cm:presenceUsername">               <type>d:text</type>            </property>            <property name="cm:organization">               <type>d:text</type>            </property>            <property name="cm:jobtitle">               <type>d:text</type>            </property>            <property name="cm:location">               <type>d:text</type>            </property>            <property name="cm:persondescription">               <type>d:content</type>            </property>            <property name="cm:telephone">               <type>d:text</type>            </property>            <property name="cm:mobile">               <type>d:text</type>            </property>            <property name="cm:companyaddress1">               <type>d:text</type>            </property>            <property name="cm:companyaddress2">               <type>d:text</type>            </property>            <property name="cm:companyaddress3">               <type>d:text</type>            </property>            <property name="cm:companypostcode">               <type>d:text</type>            </property>            <property name="cm:companytelephone">               <type>d:text</type>            </property>            <property name="cm:companyfax">               <type>d:text</type>            </property>            <property name="cm:companyemail">               <type>d:text</type>            </property>            <property name="cm:skype">               <type>d:text</type>            </property>            <property name="cm:instantmsg">               <type>d:text</type>            </property>            <property name="cm:userStatus">               <type>d:text</type>            </property>            <property name="cm:userStatusTime">               <type>d:datetime</type>            </property>            <property name="cm:googleusername">               <type>d:text</type>            </property>                        <!– system maintained values –>            <property name="cm:sizeCurrent">                <type>d:long</type>                <protected>true</protected>                <mandatory enforced="true">true</mandatory>            </property>            <property name="cm:sizeQuota">                <type>d:long</type>                <protected>true</protected>            </property>         </properties>                  <associations>            <association name="cm:avatar">               <source>                  <role>cm:avatarOf</role>                  <mandatory>false</mandatory>                  <many>false</many>               </source>               <target>                  <class>cm:content</class>                  <role>cm:hasAvatar</role>                  <mandatory>false</mandatory>                  <many>false</many>               </target>            </association>         </associations>        <aspects>           <aspect>sub:substitutionable</aspect>        </aspects>      </type>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Restart Alfresco.

1. How to be insuring that contentModel extending succesfuly?
2. How to setting/getting new properties using JavaScript API?
3. How to extending Share User Profile page to display new property?

Thanks

stormbringer
Champ in-the-making
Champ in-the-making
Hi!
I'm trying to extend person content model. I've created custom content model, added aspects as described in vasjuk's post, but nothing happened. There are no added properties when retrieve information about newly created user using RESTful api (e.g. http://localhost:8080/alfresco/service/api/people/myuser). Should these properties be included in that response, or how can I check existence of that properties?

Your help will be highly appreciated!!!