Setting roles and functions

In order to set a function (permission) for a site, you can add an entry to the tool registration xml, using the "function" tag.

Example:

 
<?xml version="1.0"?>
<registration>
        <tool
                        id="sakai.importtool"
                        title="Import"
                        description="Import tool.">
                <category name="course" />
                <category name="project" />
                
                
        </tool>
       <function name="import.view" /> 
</registration>

You can then inject the SecurityService in your service, and call this method:

boolean securityService.unlock( functionName, resourceId )

example: securityService.unlock ("import.view", "2005012003")

which will return true if the current user has import.view permission on site 2005012003.