You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by ron bennatan <rb...@hotmail.com> on 2003/02/24 17:02:42 UTC

Programmatically adding allow-if-owner to a SecurityEntry

I am trying to programmatically create new security entries.

Everything works fine apart from the fact that I am not sure how to add 
permissions for the owner. What I am trying to do is get behavior similar to 
that attained when you have an registry entry which includes:

        <access action="*">
            <allow-if-owner
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:type="java:org.apache.jetspeed.om.registry.base.BaseSecurityAllowOwner"/>
        </access>

I did not find anything which seems to do the job in SecurityEntry. The 
closest thing I could find was:

public boolean allowsUser(java.lang.String userName,
                          java.lang.String action,
                          java.lang.String ownerUserName)

but I do not know the owner name (nor do I care - I just want to set it for 
the current active owner).

How should I proceed about adding this owner permission? If I need to use 
the above method how to I get the current owner?

Thanks,
-Ron

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


Re: Programmatically adding allow-if-owner to a SecurityEntry

Posted by David Sean Taylor <da...@bluesunrise.com>.
On Monday, February 24, 2003, at 08:02  AM, ron bennatan wrote:

> I am trying to programmatically create new security entries.
>
> Everything works fine apart from the fact that I am not sure how to  
> add permissions for the owner. What I am trying to do is get behavior  
> similar to that attained when you have an registry entry which  
> includes:
>
>        <access action="*">
>            <allow-if-owner
>                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
> xsi:type="java:org.apache.jetspeed.om.registry.base.BaseSecurityAllowOw 
> ner"/>
>        </access>
>
> I did not find anything which seems to do the job in SecurityEntry.  
> The closest thing I could find was:
>
> public boolean allowsUser(java.lang.String userName,
>                          java.lang.String action,
>                          java.lang.String ownerUserName)
>
No, thats an authorization action (security check)

> but I do not know the owner name (nor do I care - I just want to set  
> it for the current active owner).
>
> How should I proceed about adding this owner permission? If I need to  
> use the above method how to I get the current owner?
>

SecurityEntry.setAccesses(Vector accesses);
Then follow it down, you can call

SecurityAccess.setAllows(Vector allows)
and
SecurityAccess.setAction(String action), which is either * or the  
permission

So you would use the registry api to get the particular entry, and then  
start manipulating it

SecurityAccess access = new SecurityAccess();
access.setOwnerAllows(Vector ?)
That seems wrong,. a vector. But thats what it takes. I don't know why.  
Our design was to have only one <allow-if-owner per <access.
Looks like a bug to me in the castor mapping, but you can still use it  
for now (with a vector) until its fixed
The Owner Allows should contain  SecurityAllows objects

--
David Sean Taylor
Bluesunrise Software
david@bluesunrise.com
+01 707 773-4646




---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org