cancel
Showing results for 
Search instead for 
Did you mean: 

Recommendations for Custom Self-Registration App.

pjaromin
Champ on-the-rise
Champ on-the-rise
I've been charged with creating a basic self-registration app for Alfresco. The basic app would capture a user's registration information - which would essentially mirror
sys:person
.

The external app then needs to store this registration in the repository and kick off an approval workflow so that an administrator can review the application and either approve or reject the registration.

I've used the repo APIs (api/people) to create users and workflows in the past. However, I'm not sure of the best way to create a "tentative" user and then put that user through workflow.

I could probably create my own extension of
sys:person
and then create a normal document of this type, which then goes through custom workflow approval, resulting in a new user upon approval.

However, I'm thinking there might be a better way?

I could see perhaps creating a disabled person instead. However is there a way to then run this person through standard workflow and "enable" them upon approval or delete them upon rejection?

Thoughts/ideas?

This needs to work on community 4.0.e btw.

Thanks!

-Patrick
4 REPLIES 4

pawel_rzeszowsk
Champ in-the-making
Champ in-the-making
You can enable a user account in your workflow using javascript or java.
In javascript the code would look something like this:
<javascript>
var query = "@usr\\:username:\"youserToFindName\"";
var userStoreReference = "user://alfrescoUserStore";
var usersResultList = search.luceneSearch(userStoreReference, query);
var userInTheUserStore = usersResultList[0];
userInTheUserStore.properties["usr:enabled"] = true;
userInTheUserStore.save();
</javascript>

Best Regards,
Pawel Rzeszowski.

Thanks, Pawel. That should come in handy!

I've started the process and have verified that you can put a
sys:person
node in a workflow as the workflow item. So now I need to sort out the best way to modify the workflow task edit form so that the person item either displays all pertinent information, or the link goes to an appropriate view. Right now, if you click on a
sys:person
item in workflow in Share, the document-details page is not very happy.

you can put just a username to your workflow as string, which will be used in Lucene query.
According to display cmSmiley Tongueerson in workflow form please take a look at authority.ftl and taskowner.ftl.
Regards,
Pawel Rzeszowski.

I wound up putting the person in the workflow - it was easier and cleaner as I was able to create a customized packageItems component that showed a link to the user profile.

I tried initially using people.enableAccount, but for some reason 'runAs' in my Activiti workflow didn't work…and after a couple frustrating debugging sessions I decided to try your previously supplied query. This worked just fine on my local dev system (using maven), however when migrated to a server it complained that SOLR can't search the user store.

So, ultimately I wound up overridding enableAccount to wrap in a 'runAsSystem' call. In my environment only admins have access to the data dictionary or javascript console, so the risks should be minimal.

Hopefully I'll figure out why runAs isn't working - it appears to be a bug, though I don't have time to determine this. Obviously enabling a user within a workflow script is outside the typical use case and likely why this isn't working for me ootb.

Thanks!

-Patrick