0

The app I'm working on revolves around users belonging to organisations, and only being able to access resources in those organisations. That much is fine, and pretty straight forward.

The system also has users outside of any organisation, who are able to view anything within the system. When one of these users logs in, they get given a list of organisations that they would like to view. Selecting one should then give them a view of the system as if they were logged in as a standard user, but retain their superuser privileges.

Is there a nice way I can have the system know that a particular organisations has been selected and not have to have a nested resource for every path?

So for example, I want to login as superuser, and view organisationA. I want to be able to select the organisation, and simply to go

/subjects

rather than having to go to

/organisations/1/subjects

Is there any nice way of doing this?

PaReeOhNos
  • 4,338
  • 3
  • 30
  • 41

1 Answers1

0

If you don't pass the context through the url, you could store the selected organisation in the session. The problem with the session approach is, that you lose the ability to link to these pages directly since you rely on data stored in the session.

xpda
  • 15,585
  • 8
  • 51
  • 82
Yves Senn
  • 2,006
  • 16
  • 13
  • If the link never changed though surely that'd be alright? The session would only be storing that context if the user logged in was a superuser. All other users actually belong to an organisation so the session wouldn't be needed. So if the link was to /subjects then regardless of who is logged in, the link would still be just /subjects. Then if logged in as a shine admin, it would load the subjects for the organisation in the session, but if a normal user was logged in, it would load the subjects for their own organisation? – PaReeOhNos Dec 31 '12 at 01:23