You have to deal with that problem in your controller or in the file manager. You have to create a database schema which register the access rights per user and per directory.
You can create a many to many
or a many to one
relation between user
and directory
entity. This relation maps the directory with his owner
- If each user have a directory, you can create it directly when the user is created.
- If the user can have no directory, you can create the directory only when he decide to create one.
- If a user can have multiple directories (many to many relation) you have to create the directory each time a user decide to create one.
In order to deal with the access rights you have to create a second relation between user and directory. This relation maps the directory with his users who can access to it
- I think this relation should be many to many because obviously in your case a user can access many directories and directories can be accessed by many users
In order to know if a user can access a resource, the file manager will get the access rights from the database then either provide the file or return an error