AnsweredAssumed Answered

Allowing non site managers to use "inviteNominated"

Question asked by baplac on Dec 1, 2016
Latest reply on Dec 1, 2016 by afaust



I am fairly new to Alfresco and could not find an answer to my question on the forums. My problem is the following:


I'm building an application on top of Alfresco. In this application, some users have the right to invite external users to a site. In order to do this, I have written a webscript which uses the "inviteNominated" function. This function works well as long as the user calling the webscript is a Site Manager but does not work when he is not (as expected).


My first solution was to mark the webscript with runas="admin" but this does not seem to work. Indeed, when running the script as an admin, the user is able to do most things (create a new user, set permissions, ...) but it would appear the inviteNominated function still denies access despite the runas="admin" marker. I get the following error message:



org.alfresco.service.cmr.invitation.InvitationExceptionForbidden: 11010032 "Current user, x, is not a Site Manager for site: y"



My current solution is to temporarily add the user to the SiteManager group for the site in question with :


people.addAuthority(siteManagerGroup, person);
people.removeAuthority(siteManagerGroup, person);


This works but it feels less than ideal since during the (arguably small) time the webscript is running the inviteNominated function, the user is actually a site manager, which I would like to avoid.


Is there a better way to solve this problem ?

Thank you in advance