Subdirectory / permissions by subdirectory

I’m looking at building a site for a school district - we would have something like this for a directory structure for our site:


The challenge is having users that can only edit schools they belong to . . . so school1 doesn’t accidentally put pics on school2. I could consider just one install per site - but then some content could be shared between all sites . . . like the district level information should be on each of the school sites as they could be pulling content directly in . . . like a handbook for instance.

Any thoughts on how SS could do this structure?

It might be worth taking a look at the Subsites module: GitHub - silverstripe/silverstripe-subsites: Subsites module for SilverStripe CMS

That may cover a lot of what you’re trying to achieve. You might find it better to work with a subdomain structure rather than a subdirectory structure if you go down that route.

Yes, I was wondering about that one myself but we do not use subdirectories for our school sites - our subdomains might be transportation.applegrovedistruct.bogus or sis.applegrovedistrict.bogus. It’s much easier to redirect if a parent just goes to a wrong subdirectory than a wrong domain name.

That’s fair enough… it may just need a bit of configuration in the hosting environment to pass the right data into the code… not all the world, but a consideration. No matter what you do, people will definitely use the wrong address :rofl: Having clear navigation on the site is crucial!

An alternative would be to implement PermissionProvider to dynamically add edit permissions for each school that gets created. On the school DataObject you can then override canEdit() to only allow users with the permission for that school to edit them.

Bear in mind that users may still be able to edit files directly in the files section of the CMS, and accidentally or maliciously alter files that belong to a different school.