cancel
Showing results for 
Search instead for 
Did you mean: 

Adding custom Aspect to new users

srowsell
Champ in-the-making
Champ in-the-making
I followed Jeff Potts' excellent recipe for adding a custom property (using a mandatory custom Aspect) to users (from here), and it works for my installation (4.1.2 Enterprise).  Sort of.  I can make persistent changes to whatever user I'm logged in as, but when I create a new user or edit from the Admin console there is no field for this new property.  I'm not surprised that this is the case, since I haven't modified any of the relevant templates other than the "Edit Userprofile" one found at userprofile.get.html.ftl.

My question, then, is what are the templates for the Admin console's New User and Edit User, and where can they be found?  I also suspect that some other code changes might be necessary to accomplish these changes, so if someone knows that I'd be glad to know as well.

EDIT:  I'm told that I'll also be using the "Upload User CSV File" option from the Admin console to upload a bunch of users, so I'll also need to modify that.
5 REPLIES 5

zladuric
Champ on-the-rise
Champ on-the-rise
Hi,

My guess is (for Share), that you will be looking at extending this Share (frontend) part:
share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/profile/


Especially look at the userprofile.get webscript.

On the repository side, you can take a look at
alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/profile/
scripts for start.

I hope that helps.

srowsell
Champ in-the-making
Champ in-the-making
Zlatko…

That's the part that I already did.  I have already implemented a new Aspect for users; users can set or edit this property at the "Edit Profile" dialogue.  Mr. Potts' blog post that I referenced in my initial post describes this in some detail, including samples of the webscripts necessary to do so.  My problem is that this does not include the ability to add this property at user creation, or from the Admin console; right now only each user can edit or view this property.

Where I think I need to go with this – after having spent the last couple of hours poking around – is the users.js and the users.get webscript, which I'm investigating now.  I have extended the users.get.html.ftl template to include the labels/text fields, and now I have to extend the users.js functionality.  I think.

Steve

srowsell
Champ in-the-making
Champ in-the-making
Okay, maybe someone can tell me if I'm on the right track.

I have edited the users.js (and renamed it) to add in the functionality of the new property, and point to it using users.get.head.ftl.  The idea is for the new javascript to override the default users.js.  I have also edited users.get.html.ftl to add in the fields necessary, and this works just fine, but the fields are not populated by the javascript.  Just to make sure that there wasn't just a problem with the model, I had the javascript populate the field with a string "blah", but I don't see this happening in Share when I use the Admin console to edit a profile.

One thing occurs to me:  in Mr. Potts' example (which I cited in the OP) he has a block in the share-config-custom.xml file which overrides the default user-factory like so:

<blockcode><config replace="true">
      <flags>
         <client-debug>false</client-debug>
         <client-debug-autologging>false</client-debug-autologging>
      </flags>
   </config>
   <config condition="WebFramework" evaluator="string-compare">
      <web-framework>
         <defaults>
            <user-factory>webframework.factory.user.mymodel</user-factory>
         </defaults>
      </web-framework>
   </config></blockcode>

Am I missing an override for this as well?

zladuric
Champ on-the-rise
Champ on-the-rise
Did you also overwrite the minified version of the users.js? We're talkin client side script, right?

You should also
java -jar TOMCAT_HOME/share/WEB-INF/lib/yuicompressor-version-xxx.jar share/components/users.js -o share/components/users-min.js.


I don' have the exact name of that jar, but it is usually there or just download it off of internet.

Or simply copy users.js over users-min.js for now and worry about minifying when you go to production Smiley Happy

srowsell
Champ in-the-making
Champ in-the-making
I didn't overwrite users.js, but rather I'm extending it by pointing to another .js file (in users.get.head.ftl), and yes, I did include the minified version of that file.