cancel
Showing results for 
Search instead for 
Did you mean: 

Allowing non site managers to use "inviteNominated"

baplac
Champ in-the-making
Champ in-the-making

Hello,

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);
site.inviteNominated(...);
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

1 ACCEPTED ANSWER

afaust
Legendary Innovator
Legendary Innovator

There is no way to extend that privilege to users outside of the site manager role. This is a business restriction programmed into the invitation service and not actually related to permission which is why it does not work simply by putting runAs=admin in there.

Really the only option to achieve this would require replacing the invitation service implementation with something custom, which certainly is too much effort to be worth it.

View answer in original post

1 REPLY 1

afaust
Legendary Innovator
Legendary Innovator

There is no way to extend that privilege to users outside of the site manager role. This is a business restriction programmed into the invitation service and not actually related to permission which is why it does not work simply by putting runAs=admin in there.

Really the only option to achieve this would require replacing the invitation service implementation with something custom, which certainly is too much effort to be worth it.