34 comments

  1. Darryl Woods says:

    Thanks for the awesome sample Jeff, this definitely gives me a good starting point.

    I’m a bit confused as to how you attach your additional properties to the out-of the-box person type though (maybe I’m missing something?).

    I addition to adding the additional properties to the user profile in Share, we also need some of the properties to be set via LDAP/AD sync, as well as some by an automated script that will pull them in from an external user directory database.

    I have created an aspect for the additional properties but I’d like to make my new aspect mandatory for the cm:person type.

    Any suggestions on the best way to accomplish this?

    Thanks

  2. jpotts says:

    Darryl,

    Attaching the aspect to the person object is going to depend on the specific situation. I’ve had some projects where the creation of new accounts was automated and, in part, implemented by a web script. So we just attached the aspect in code when we created the accounts. You could edit the out-of-the-box model file to make the aspect mandatory. But I’d only do that as a last resort. In your case, you don’t have a single mechanism for creating users, so the “do it when you create the users” approach won’t work. Instead, you might want to create a behavior. The behavior can bind to the onCreateNode policy of cm:person. Your code can check for the presence of the aspect and add it if it isn’t there.

    Jeff

  3. Darryl Woods says:

    Thanks Jeff!

    After reading your suggestions and thinking about it a bit more, I see that using mandatory aspect on cm:person would be a bad idea (it doesn’t apply to external users, for one).

    Since organizational users will always come from the Active Directory sync, it makes sense to just attach the aspect there during that process, as you said.

    I’m definitely starting to see the flexibility aspects gives you in Alfresco.

    Best Regards,
    Darryl

  4. chris says:

    I’m about to try this with 4.0.d, any tips. I’ll report back soon.

    thanks, yet again, Jeff

    cheers
    chris

  5. jpotts says:

    Michael,

    I would be shocked if that were the cause of the issue for a couple of reasons. First, that blog post mentions that the checksum feature hasn’t been added to any release–it is only in head. You appear to be using 4.0.1 Enterprise. Second, that feature helps by caching JavaScript files. The sc-profile.js file is a new, custom JS file, so if this feature were in place and if the reference were changed to leverage it, the file would simply be cached.

    I haven’t tested the code against 4.0.1 Enterprise so I’m not sure what the problem is off-hand. I suspect that the problem is that the example was written for 3.4.d Community and that there have been enough changes between that release and the one you are using to cause an issue.

    Chris, another poster on this thread, said they were going to try this on 4.0.d so it will be interesting to see how that goes. Whatever changes have to be made there to get it to work on 4.0.d will likely have to be made to support 4.0.1 Enterprise.

    Jeff

  6. Hung says:

    Hi Jeff,

    Thanks for a very useful tutorial… really helpful.

    I’m very new to Alfresco and the problem I’m having here related to custom properties (meta-data) for documents

    This is what I want: custom fields can be added on the fly for each space, so that different spaces can have different set of meta data for its document.

    I’m not sure if you can do such things with Alfresco? Would you please provide me some advise?

    Regards,
    Hung

  7. jpotts says:

    Hung,

    You can add custom fields to a space. You can do that be either extending the cm:folder type with your own type that contains the custom fields or by creating an aspect with the custom fields and then applying that aspect to the folder. Either way, the properties will be stored with the folder. Documents can also have custom properties by using the same methods: Either extend cm:content with your own custom type or create an aspect and apply it to the document.

    If you want to learn more about creating and configuring custom types, take a look at this tutorial.

    Jeff

  8. Hung says:

    Hi Jeff,

    Thanks for your reply. I managed to modify the metadata using XML config, but in the end, you will have to restart tomcat to get all the changes work.

    Is there anyway you can modify the meta data without the need of restarting server?

    Thanks,
    Hung

  9. Hung says:

    It would be nice to provide end-user some sort of forms so they can add custom content types / meta data directly. I’d be desperate for something like that

    Thanks,
    Hung

  10. jpotts says:

    Yes, those are called “hot-deployed” or “dynamic” models. You basically check your content model and your web client configuration into the repository as if it were content. See the documentation.

  11. Hung says:

    It’s a shame I didn’t even know the existence of Alfresco Add-ons

    You saved my day Jeff *Salute*

  12. Hung says:

    Hi Jeff,

    Is there any chance you can make a sample for adding custom properties into site?

    I’m trying to add a custom property field into a site. I noticed that there’s existing aspect for custom properties in the siteModel.xml file. Just wonder how can I save the custom properties in the create site / edit site form…

    Really appreciate your help.

    Regards,
    Hung

  13. Michael says:

    Hi Jeff,
    I’m dealing with the problem that I want alfresco share to remember login , so after check “Remember me” checkbox and login successfully, user doesn’t have to log in the next time. Unfortunately, I couldn’t find any clue about this. Could you please give me some ? 🙂

    Regards,
    Michael

  14. Nirvan V. Jain says:

    Hi Jeff,

    Can you please share the Zip of all the code file changes of the same ?

    As I have not implemented the same earilar and want to implement the same now.

    Request you to share the ZIP of all files changes again,Please.

    Thanks!
    -Nirvan

  15. Hi Jeff,

    hope you accept an other reply to this post from february. I migrated your code to a maven project and created an amp for repo stuff and an jar for the share extensions. The gui is working fine but unfortunatelly the persistence is not working. I get following exception:


    Caused by: java.lang.NoSuchMethodError: org.springframework.extensions.webscripts.json.JSONWriter.startObject()V
    at de.ppi.share.PpiUserFactory.saveUser(PpiUserFactory.java:66)
    at org.alfresco.web.site.SlingshotUser.save(SlingshotUser.java:55)
    at org.springframework.extensions.webscripts.ScriptUser.save(ScriptUser.java:317)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)

    Do you have an idea for me where to search the problem?

  16. Hi Jeff,
    I managed to complete this tutorial for Alfresco Community 4.0.b and I have one question.

    The newly added aspect to the profile in Share is valid only for Share, am I wrong? If I want to add an aspect to the effective Content model I have to overwrite the orginal CM with an entire custom one I guess…
    In my case I would like to add a sort of chief relationship (for an employee I want to associate a cm:person as *:chief), is there a way to easily select the person in the same way we select the bpm:assignee in the review workflows?

    Thanks for your blog and your articles,we’re waiting for a new Developer Book!

  17. Chris says:

    Hi Jeff,

    I’ve followed these steps on alfresco 4e community, but it caused an issue for my installation. We had been using NTLM auth over ldap without issue, but after deploying and restarting alfresco I am no longer logged in with my domain credentials. User’s are displayed the login page and catalina.out reports: Exception from executeScript – redirecting to status template error: 09170248 Guest authentication not supported

    Users can still enter their details to login manually. Do you know what may have caused this?

  18. Lejuste says:

    Hello Jeff,

    Thanks you very mutch or your post.

    I am new with Alfresco and would like to add 2 properties to a person. I do this by following your sample.

    Unfortunetly there is no property displayed in share.

    I do have any error.

    I am using Alfresco 4.1.1. Could give me an idea ?

    Thanks in advance,

    Calavero.

  19. Chris says:

    Yeah, have done but I kind of assume I won’t get any responses. I reckon what’s going to happen here is I will revert the changes I made and we will keep these additional details outside Alfresco, it seems like a whole lot more trouble than it’s worth. I certainly hope that this is a simpler process in the future, more similar to the process to extend the content type.

  20. jpotts says:

    Calavero,

    I have not tried extending the person object with 4.1.1. I may have some time to do this after DevCon.

    Jeff

  21. Varun says:

    Hello,

    We have added the custom aspects and fields in alfresco share, but we are not able to fetch these property values in the drupal front end. Any help on this?

    Thanks
    Varun

  22. Christian Rincón says:

    Hello,
    Do you know how to extend Person Properties in Alfresco Community 4.0.2?? I’ve read this tip, but it doesn’t work in mine.

    Thanks In Advance.

  23. Bernie says:

    Hi Jeff,
    This is a very good post. Right in time as I was looking on how to extend the cm:person with custom properties. I have a requirement where a created user can have an expiration (more of a temporary account). But I believed this is not currently supported by Alfresco? I am using Alfresco Community 4.2c. I am planning to add an aspect to cm:person with properties which determines if the user account expires and on what date it will expire. I plan to disable or maybe delete the user by using a custom scheduled action. Is this a good approach? or can you give insights to some other good approach?

    Thanks in advance!
    Bernie

  24. Eric D. Soto says:

    Hi Jeff,

    Thank you for such a wonderful and time-saving demonstration! I can confirm that your customization works beautifully on Alfresco Enterprise 4.0.2.9. For anyone reading, just follow the example at https://ecmarchitect.com/images/articles/alfresco-people/someco-people.zip

    One caveat however… your Eclipse/IDEA project must include the alfresco-share-4.0.2.9.jar library from the SDK, since it contains the SlingshotUserFactory class needed to extend cm:person. This one bit me until I figured it out.

    One question: is there a similar example for adding the extended cm:person fields to the admin-console in Share? If not, can you provide a roadmap of how this could be done?

    Thanks again and keep up the good work!

Comments are closed.