Hi,
Was wondering if the following is possible...
let me explain my scenario. The site has 2 types of users (multiple users)
Every User of type A has 1 folder in their name and files and subfolders in their main folder. These users create content of type A. Every node of type A that they create will get its special folder within their main folder. Every node is referenced by users of role B. So these users have access to only those node they are referenced to. User of type A has access to all the folders of all the nodes he creates.

So if give User 1 of type A a url such as reports||user1, he is able to see only his folder and all the folders inside it. this works great

Now user 1 has node 1 created and node 2 created. there is user 2 who should view only folders of node 2 so i give him the url reports||user1||node2. Perfect and he sees only his folders and files.

BUT if he gets curious and presses the up button in the navigation or just removes the node2 from his url and decides to go backwards, he can end up seeing all the files and folders in the system, which is nto what i want. So is there a way to restrict the user to only a forward movement along the url based on the url he is provided with?

Would be of tremendous help if I could pointed in the right direction.

Thanks
jaya

Comments

luxpaparazzi’s picture

Thanks for your post.

Did you try removing all permissions from the top directory (or main module permissions) and setting permissions for the different sub-directories as required?

Some basic rules:
1. A user sees all files and directories if he has read-right of the parent.
2. A user may only enter a directory if he has rights on this directory.
3. A user may not see contents only by it's url if he does not have permission.

If you have any further questions, you are free to ask ;)

j4’s picture

The problem with setting permissions for each subdirectory, would be the fact that the site will have thousands of users (or so they say..;) ) and each user will have his own folder and subfolders. So i felt that to automate this process, it would be simpler to get them to not be able to go back frlom the url they are provided..which means onwards, all folders they can access, backwards they get access denied or get shown only their own folder there. So manually setting permissions for every directory will not be possible. Can that setting of permissions be automated in some way with rules? Sorry to be bugging you! :) and thank you for taking the time to discuss this with me!

luxpaparazzi’s picture

ok, i mean, you want add a "user folder" automatically for every new user?

1. User account X created
2. If user gets a specified role, the module should create a directory Y for him
3. User X will get full access to Directory Y, anyone else will have no access

Parent folder will have no access, so nobody will be able to see the other folders.

Is this what you want? I should be able creating a sponsored module for this, should not be to complicated.

luxpaparazzi’s picture

Category: support » feature
j4’s picture

Hi,

This will be great, but there is a further clause to this.

User X of Role A gets created: folder X gets created (here possible to use tokens to name folder as per role?)
User X creates content of type A. For every content of type A, a folder is created WITHIN the author's folder. So user X has access to all folders in his folder and all the files in it.
Now every content of type A has referenced users of Role B. All users referenced by a node should have access to that folder AND NOT THE PARENT FOLDER or the other folders in that main parent folder.
Is this possible at all? :(
I can do it in such a way that a user gets the link only based on the folder he has access to. That is why i was wondering if we can allow them to move forward along that url but not back beyond what we give them.
For instance: user y referenced by node1 of user X will have the link:
www.site.com/dir||reports||userX||node1
So he sees all files and maybe folders within node1, but if he goes i step backwards to the folder userX, he sees only his folder node1, even though user X has already created node2 also. And if he moves further back to reports, he sees access denied message.

Thanks for taking the time!
Jaya

luxpaparazzi’s picture

> here possible to use tokens to name folder as per role?
this should be possible, i would add a field a module-custom-field to the roles.
I suppose you think of the token-module? I will just need to check the APIs for details, I may provide you details at a later time.

> Now every content of type A has referenced users of Role B. All users referenced by a node should have access to that folder AND NOT THE PARENT FOLDER or the other folders in that main parent folder.

For this you just need to remove all the permissions on the parent folder, and set the permissions on sub-folders one by one (a future module could ease this task)

> User X creates content of type A. For every content of type A, a folder is created WITHIN the author's folder. So user X has access to all folders in his folder and all the files in it.

Did you check the odir_field module? It allows you to associate directories to nodes.
It would require an auto-value in your case, i suppose?

> www.site.com/dir||reports||userX||node1
Actually node1 would appear www.site.com/node/1
I could enhance this as well...

> So he sees all files and maybe folders within node1, but if he goes i step backwards to the folder userX, he sees only his folder node1, even though user X has already created node2 also. And if he moves further back to reports, he sees access denied message.

That's actually what you get when you remove all permissions from the root folder.

j4’s picture

Hi,

>For this you just need to remove all the permissions on the parent folder, and set the permissions on sub-folders one by one (a future module could ease this task)

So in our current scenario this is not possible, right?

>Did you check the odir_field module? It allows you to associate directories to nodes.
Yes I did, but maybe i missed seeing how to use it. For some reason enabling it also caused a problem in my site of making all my webforms accessible only to the admin. I dont know what the connection is. Disabling it brought the webforms back to normal.

>Actually node1 would appear www.site.com/node/1
I could enhance this as well...
When would you be able to do this? Would that be a patch in the current module or would it require aa submodule?

>That's actually what you get when you remove all permissions from the root folder.
How do i automate this?

Thank you so much for taking this forward!

Warm regards
Jaya

luxpaparazzi’s picture

>>Did you check the odir_field module? It allows you to associate directories to nodes.
>Yes I did, but maybe i missed seeing how to use it. For some reason enabling it also caused a problem in my site of making all my webforms accessible only to the admin. I dont know what the connection is. Disabling it brought the webforms back to normal.

If you enable odir_field module and associate the fields to content types, it will check permissions of the directory. If it's blank you have to check node permissions of the root folder...

For any further issues regarding this module feel free to ask...

>>Actually node1 would appear www.site.com/node/1
>> I could enhance this as well...
>When would you be able to do this? Would that be a patch in the current module or would it require aa submodule?

I don't have any current plans, but could arrange something in the near future...

>>That's actually what you get when you remove all permissions from the root folder.
>How do i automate this?
No automation routines actually exists, but removing permissions on root folder should be quite easy.
For automating setting permissions on subfolders i could create a custom module for this.

j4’s picture

Hi,

>For automating setting permissions on subfolders i could create a custom module for this.

I am willing to pay for your time to do this..my way of giving back to Drupal for all that I have received from it. Could you please tell me if you can take this forward?

Thank you!
Jaya

j4’s picture

Switching on the odir_field module makes my webforms unavailable to anonymous users for some reason. Like how the odir_field module can be used to reference directories to nodes, can we reverse the direction? That way if we reference some node to a directory, then can it be made to take on the permissions of the node? In which case it would make it easier to attach permissions to the directory? Please forgive me if my thought process doesnt make sense! I feel helpless that I dont know enough php to contribute!

Thank you again for the time.
Jaya

luxpaparazzi’s picture

> Switching on the odir_field module makes my webforms unavailable to anonymous users

did you set permissions for directory based node creation?
i suppose there is an odir field associated with "webforms", for any further assistance on this, it bould be better if you create an issue on the odir_field page http://drupal.org/project/odir_field

luxpaparazzi’s picture

I created a sandbox projects, for the user directories:

Organisational user directories (odir_user)
http://drupal.org/sandbox/luxpaparazzi/1770274

No development has yet be done, but I prefer if any issues would go to this project page.

luxpaparazzi’s picture

Status: Active » Closed (fixed)