[Building Sakai] How to set tool wise permission?

Steve Swinsburg steve.swinsburg at gmail.com
Tue Feb 21 14:53:52 PST 2012


That permission probably needs to look like this:

String siteRef = siteService.siteReference(siteId); // (1)
if (securityService.unlock(userId, "tool.permission", siteRef)) { // (2)
	// do something since this user has permission
}

ref: https://confluence.sakaiproject.org/display/BOOT/Using+the+SecurityService

Though I see your code comes from:
https://confluence.sakaiproject.org/display/BOOT/Using+the+AuthzGroup+Service

cheers,
Steve


On 17/02/2012, at 9:01 AM, Steve Swinsburg wrote:

> So drilling into it the entire project (you only needed to post the lines that relate to this), I see:
> 
> // register Sakai permissions for this tool
> functionManager.registerFunction(ITEM_WRITE_ANY);
> functionManager.registerFunction(ITEM_READ_HIDDEN);
> 		
> functionManager.registerFunction(ITEM_WRITE);
> functionManager.registerFunction(ITEM_READ);
> 
> So assuming those map to the values you are assigning in the Realms tool, then they should show up in the list and be assignable to roles.
> 
> What doesn't work when you enable the permissions for a role?
> 
> cheers,
> Steve
> 
> 
> 
> On 17/02/2012, at 1:47 AM, Shahid Pathan wrote:
> 
>> Hi Steve,
>> 
>> Thanks for your suggestion. Now I am going through the https://confluence.sakaiproject.org/display/BOOT/Using+the+FunctionManager+Service to understand how to register tool with permission and let you know. I have attached my code. Please have a look. 
>> 
>> I did not understand the " IIRC there is a helper". Where do I find this?
>> 
>> Thanks
>> Shahid
>> 
>> On Thu, Feb 16, 2012 at 2:35 AM, Steve Swinsburg <steve.swinsburg at gmail.com> wrote:
>> Hi,
>> 
>> Does your tool register the permissions? Can you post the code? They are just binary permissions (on or off) so once you register them they should show up and you can start assigning them to roles.
>> 
>> Have a look at the code for how other tools mange the 'permissions' page within the tool itself, IIRC there is a helper.
>> 
>> cheers.
>> Steve
>> 
>> 
>> On 16/02/2012, at 6:18 AM, Shahid Pathan wrote:
>> 
>> > Hi All,
>> >
>> > I have created 3 different module (employee, adaptive test, summetive test) and deployed in sakai.
>> >
>> > After that I have created one course site (let say Math-2012) and added above tool for this.
>> > Now I want to assign permission for this 3 different user. For that I am trying to create 3 different role as follows
>> >
>> > 1>empuser :- who can access only employee tool not other in Math-2012 site
>> > 2>adpuser :- who can access only adaptive tool not other in Math-2012 site
>> > 3>sumuser :- who can access only summetive tool not other in Math-2012 site.
>> >
>> > but I found that while creating role we have to select Function form the list of Function (for example     alias.add, alias.del)
>> > and I am unable to find such function for my newly created modules (there are some other function let say employee.read.hidden and employee.write.any) but its not working as expected.
>> >
>> > Can any point me what am i missing?
>> > Do we have other approach to set permission on each tools?
>> >
>> > One strange thing i noticed, for existing tool we have link "Permission" present in each tools home page thorough with administrator can set different permission for each role
>> > that link is not visible for my newly created tool. If I want to add such link in my tools home page what need to done in JSF page.
>> >
>> > Thanks
>> > Shahid Pathan
>> >
>> > _______________________________________________
>> > sakai-dev mailing list
>> > sakai-dev at collab.sakaiproject.org
>> > http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>> >
>> > TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
>> 
>> 
>> <employee.zip>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20120222/1f457c88/attachment.html 


More information about the sakai-dev mailing list