Hi Grégory
Well, I would not go as far as calling it a bug. But there might be
some room for improvements: When trying to create /foo/bar with the
method
ContentUtil.createPath(HierarchyManager hm, String path, ItemType type)
the code does not check if /foo exists, but first tries to get the
root node / for which one needs read permissions of course. So this
fails for users who only have read(+write) permissions on the /foo
folder.
I think it would be better if one would take the "top to bottom"
approach:
- First check if /foo/bar exists and return it, if it does.
- If not check if /foo exists, and use it as parent node to create a
bar node underneath, if it does.
- If not finally use / as parent node to create the foo and bar nodes
underneath
But as I said: I got around it by using
ContentUtil.createPath(Content parent, String path, ItemType type)
instead and providing a parent node for which my user does have the
necessary permissions.
This is on Mag 3.6.1 btw.
Regards,
Will
On 02.10.2008,
23:58, Grégory Joseph wrote:
Will,
Are we still talking about a bug? Maybe the javadoc needs
clarification? (I am not reading the code while writing this;)) -
the normally behaviour if you try to create /foo/bar, is to check if
you have the "write" permission on /foo. Was something else
happening with either of both ContentUtil methods?
Also - are you working with 3.7 snapshots or 3.6?
Thanks,
-g
On Oct 2, 2008, at 9:42 PM, Will Scheidegger wrote:
Answering my own question:
Yes, its
ContentUtil.createPath(HierarchyManager hm, String path, ItemType
type)
which causes the problems because it tries to get the root node as
parent node. So if you _have_ an existing base folder where your
user has access to you can use
ContentUtil.createPath(Content parent, String path, ItemType type)
and you'll be fine.
Cheers,
will
On 02.10.2008, at 21:18, Will Scheidegger wrote:
Dear Magnolians
I'm currently working on a Magnolia site where registered users
can create data module records. Their records are placed in a
folder structure just like the HierarchicalUserManager structures
the user accounts. All these folders are kept in one base folder,
e.g. "/base". The role for these users of course has read+write
permission on this folder and its subfolders.
For some strange reason however I'm getting an
AccessDeniedException when trying to create subfolders to the "/
base" folder because "User not allowed to Read path [/]". The
first few lines of the stack trace are:
at info.magnolia.cms.core.Access.isGranted(Access.java:63)
at
info.magnolia.cms.core.DefaultContent.<init>(DefaultContent.java:
144)
at
info
.magnolia
.cms
.core.DefaultHierarchyManager.getRoot(DefaultHierarchyManager.java:
408)
at
info.magnolia.cms.util.ContentUtil.createPath(ContentUtil.java:374)
at
ch
.fastforward
.coach
.controller.CoachController.createNewNode(CoachController.java:122)
And that line 122 in my CoachController class is:
ContentUtil.createPath(MgnlContext.getHierarchyManager("data"),
parentPath, new ItemType("dataFolder"), true);
Now why does this code try to read from "/"? I don't think it
really has to, because creating folders and data nodes in Admin
Central works perfectly find for a user that only has read+write
permissions to "/base" instead of "/"... Is this a bug? Or is it
the nature of the "createPath" method that it tries to access all
parts of the path from the root up?
Regards,
Will
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------
----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------