You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by hsp <pi...@ibest.com.br> on 2013/09/12 15:05:43 UTC
Granted permission to remove operation
I am facing a "issue" in my rules when a user in the session invokes the
node.remove().
The api did not call the "isGranted(Path absPath, int permissions)" in this
invoke to remove(), but when the user calls session.save() the
"isGranted(Path absPath, int permissions)" method is entered but the
item/properties is not there anymore and the operation is permited and
saved, but the user was not with that permission to remove the node... so,
how to check the remove permission when the ItemManager will not find to
node to check this (this happens independently if the user has or not the
remove permission).
I did a call to "checkPermission" before invoke the "remove" as a
workaround, but I think the api would check this on demand by the
org.apache.jackrabbit.core.security.AccessManager implementation, not???
I am doing my own rules to achieve the rights for the user, and my
implementation was based on version 1.4, and now after upgrading to 2.6.3 I
needed to adequate the levels of permissions and methods of the interface
AccessManager, but it seems that the api changed the way to check the
permissions and it is not like in version 1.4 at least for the "node.remove"
method.
I will apreciate any directions of help,
Regards
--
View this message in context: http://jackrabbit.510166.n4.nabble.com/Granted-permission-to-remove-operation-tp4659526.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Granted permission to remove operation
Posted by hsp <pi...@ibest.com.br>.
In my case, I put and if condition to test Permission.REMOVE_NODE and
REMOVE_PROPERTY, and open a session with admin rigths to retrieve the ItemId
with that path, and after getting the session in thread and retrieve de
permissions in cache for that ItemId. Works in my case.
Again, if you can help me anyway...
Thanks
Helio.
--
View this message in context: http://jackrabbit.510166.n4.nabble.com/Granted-permission-to-remove-operation-tp4659526p4659537.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Granted permission to remove operation
Posted by hsp <pi...@ibest.com.br>.
Angela;
How to get a session in separate? probably with admin rights?
with: session.impersonate(credentials) ?
or, can you provide me such default implementation?
Thanks in advanced!
--
View this message in context: http://jackrabbit.510166.n4.nabble.com/Granted-permission-to-remove-operation-tp4659526p4659531.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Granted permission to remove operation
Posted by Angela Schreiber <an...@adobe.com>.
hi
in fact all regular jcr-write operations (adding nodes, setting
properties as well as removing) are only checked for sufficient
permissions upon saving.
if i get you right, your access manager uses the same session
or it's associated ItemManager or ItemStateProvider that already
removed the item... if that's the case it obviously doesn't
work...
so, what you would need to have is access to the persisted
state that doesn't have any transient modifications applied.
in the default implementation we used to do this using a
separate system session.
an alternative would be to keep the ItemStateManager
which still reflects the persisted state without the transient
modifications... but i don't know by heart if that's feasible.
kind regards
angela
On 9/12/13 6:43 PM, "hsp" <pi...@ibest.com.br> wrote:
>Ok Angela, thanks by your attention,
>I see it in:
>NodeImpl.onRemove(NodeId p)
>
>
>
>So, if the permission was not checked against the node BEFORE invoke
>node.remove(), it will be removed for that session...
>In the run of save call, in the validateTransientItems method, line 700,
>it
>call the isGranted method:
>
>
>But in my code, when I try to get the Item/Property by the path, I just
>can't because it doesn't exist anymore, so it is impossible to check if
>the
>operation is permitted, at least in the way I store the nodes with the
>tree
>permission control as child nodes of the item being removed/checked... It
>would be great if you suggest me a proper way to rescue the item to
>check...
>
>Let's see a portion of my code, just the important code envolved (I think
>provide you a test case with my code will be problematic for me, anyway I
>will try to put/simulate the environment later...)
>
>
>
>
>
>
>--
>View this message in context:
>http://jackrabbit.510166.n4.nabble.com/Granted-permission-to-remove-operat
>ion-tp4659526p4659529.html
>Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Granted permission to remove operation
Posted by hsp <pi...@ibest.com.br>.
Ok Angela, thanks by your attention,
I see it in:
NodeImpl.onRemove(NodeId p)
So, if the permission was not checked against the node BEFORE invoke
node.remove(), it will be removed for that session...
In the run of save call, in the validateTransientItems method, line 700, it
call the isGranted method:
But in my code, when I try to get the Item/Property by the path, I just
can't because it doesn't exist anymore, so it is impossible to check if the
operation is permitted, at least in the way I store the nodes with the tree
permission control as child nodes of the item being removed/checked... It
would be great if you suggest me a proper way to rescue the item to check...
Let's see a portion of my code, just the important code envolved (I think
provide you a test case with my code will be problematic for me, anyway I
will try to put/simulate the environment later...)
--
View this message in context: http://jackrabbit.510166.n4.nabble.com/Granted-permission-to-remove-operation-tp4659526p4659529.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
Re: Granted permission to remove operation
Posted by Angela Schreiber <an...@adobe.com>.
hi
not sure that i understand what you are saying.
jackrabbit does check for sufficient permission to remove
a node or property in the run of the save call.
as far as i understood you are having your custom
implementation of the access manager and run into troubles
while upgrading to a more recent version. can you provide
a test that illustrates the problem?
kind regards
angela
On 9/12/13 3:05 PM, "hsp" <pi...@ibest.com.br> wrote:
>I am facing a "issue" in my rules when a user in the session invokes the
>node.remove().
>The api did not call the "isGranted(Path absPath, int permissions)" in
>this
>invoke to remove(), but when the user calls session.save() the
>"isGranted(Path absPath, int permissions)" method is entered but the
>item/properties is not there anymore and the operation is permited and
>saved, but the user was not with that permission to remove the node... so,
>how to check the remove permission when the ItemManager will not find to
>node to check this (this happens independently if the user has or not the
>remove permission).
>
>I did a call to "checkPermission" before invoke the "remove" as a
>workaround, but I think the api would check this on demand by the
>org.apache.jackrabbit.core.security.AccessManager implementation, not???
>
>I am doing my own rules to achieve the rights for the user, and my
>implementation was based on version 1.4, and now after upgrading to 2.6.3
>I
>needed to adequate the levels of permissions and methods of the interface
>AccessManager, but it seems that the api changed the way to check the
>permissions and it is not like in version 1.4 at least for the
>"node.remove"
>method.
>
>I will apreciate any directions of help,
>Regards
>
>
>
>--
>View this message in context:
>http://jackrabbit.510166.n4.nabble.com/Granted-permission-to-remove-operat
>ion-tp4659526.html
>Sent from the Jackrabbit - Users mailing list archive at Nabble.com.