[Building Sakai] permissions.helper for a tool based on wickets

Jesus Federico jesus at blindsidenetworks.com
Tue Dec 10 11:30:24 PST 2013


Thanks Steve,

Just to recap, as I said I have the registered functions, which I
registered in a loop using functionManager.registerFunction(FUNCTIONS[i]);

So I know got registered something like this:

mytool.add
mytool.edit.own
mytool.edit.any
mytool.delete.own
mytool.delete.any

Next, I just went to the chat code and I am basically using the same url. I
am creating it like this

    public String getPermissionsHelperUrl() {
        String url = "sakai.permissions.helper.helper/tool?" +
                "session." + PermissionsHelper.DESCRIPTION + "=" +
                Web.escapeUrl("This is a test") +
                "&session." + PermissionsHelper.TARGET_REF + "=" +
                getCurrentSiteRef() +
                "&session." + PermissionsHelper.PREFIX + "=" +
                getFunctionPrefix();
        return url;
    }

The Url is created inside the onClick by the way.

           public void onClick() {
                toolEngine.setPermissionDescriptions();
                getRequestCycle().setRequestTarget(new
RedirectRequestTarget("/" + toolEngine.getPermissionsHelperUrl()));
            }

But before doing the redirect there is an step to set the permission
descriptions.

    public boolean setPermissionDescriptions(){

        boolean response = false;
        // Set permission descriptions
        ToolSession toolSession = sessionManager.getCurrentToolSession();
        if (toolSession != null) {
            Map<String, String> mapValues = new LinkedHashMap<String,
String>();
            for(int i=0; i<FUNCTIONS.length; i++){
                mapValues .put("desc-" + FUNCTIONS[i][0], FUNCTIONS[i][1]);
            }
            toolSession.setAttribute("permissionDescriptions", mapValues );
            response = true;
        }
        return response;
    }


The redirect then is going to a Url like this

http://192.168.22.148:8080/portal/tool/d4739ea3-dccd-4818-9fb3-48a0201acd5e/sakai.permissions.helper.helper/tool?session.sakaiproject.permissions.description=This%20is%20a%20test&session.sakaiproject.permissions.targetRef=/site/mercury&session.sakaiproject.permissions.prefix=mytool
.

The response is a 404 page.

Just for testing, I replaced the tool id
[d4739ea3-dccd-4818-9fb3-48a0201acd5e] with one of the other tools keeping
the same prefix (lets say the one for chat). What I got is the right UI but
with no description. But if I set the permissions, it works. I can verify
that the permissions were affected by doing a direct call  to
http://192.168.22.148:8080/direct/site/mercury/perms/mytool.json

It looks like this tool is somehow not registered to support
sakai.permissions.helper.helper

My guess was:

1. I am missing the implementation of an interface somewhere.

2. I am missing to activate something before the redirect, Or as you said,I
am missing parameters. I though I was including all of them in the Url.

But I don't really know.

Thanks again Steve.

Jesus Federico



<http://www.blindsidenetworks.com/>

*Jesus Federico*
Software Engineer, Blindside Networks Inc.

jesus at blindsidenetworks.com
skype: jesus.federico

Technical support
support at blindsidenetworks.com
+1 (613) 695-0264




On Mon, Dec 9, 2013 at 5:23 PM, Steve Swinsburg
<steve.swinsburg at gmail.com>wrote:

> Hi Jesus
>
> There is a URL you redirect to for the various helpers. First you set some
> session/request params and then redirect. What have you got so far? Ie what
> is the URL and what happens when you redirect?
>
> Cheers
> Steve
>
> sent from mobile device
> On 10/12/2013 3:38 AM, "Jesus Federico" <jesus at blindsidenetworks.com>
> wrote:
>
>> Hi everyone,
>>
>> Sorry for introducing a kind of nooby question.
>>
>> I recently started playing around with a sakai tool created from the
>> scratch using the wicket archetype. Since my previous experience is working
>> with UI based on javascript I am really entertained learning wickets and
>> also a different way to access data from Sakai.
>>
>> Anyways, what I am trying to do now is to set the permissions for the
>> tool in a context, just as any of the core tool does, meaning that I'd like
>> to use the permissions.helper.
>>
>> I have functions registered, but what I cannot do is to access them by
>> properly creating the URL to access the helper. I mean, the URL created
>> doesn't work for this tool. I am guessing that the tool must be somehow
>> registered but I don't know what component/class I should be working with.
>>
>> Any clue will be very much appreciated.
>>
>> Regards,
>>
>> Jesus Federico
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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"
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20131210/4010a9c3/attachment.html 


More information about the sakai-dev mailing list