SQL? "Show me all the Activities that can be performed by User X."

Posted by Casey Fulton on Stack Overflow See other posts from Stack Overflow or by Casey Fulton
Published on 2010-04-20T00:55:35Z Indexed on 2010/04/20 1:03 UTC
Read the original article Hit count: 259

Filed under:

I'm at my wits end. I've searched like crazy, read plenty of database textbooks and God knows how many online guides, blogs and forums. Can someone put me out of my misery?

PseudoSchema Diagram (Warning: although pretty, not in a format even remotely approaching ER diagrams! Primary keys are bold, foreign keys are italics.)

Given the above set of tables relating Users to Groups to Privileges, and then a set of Activities that can each require a Privilege to perform, how do you find out this:

Show me all the Activities that can be performed by User X. That is: User X is a member of groups G and F; groups G and F correlate to privileges P, Q, R and S; show me all the activities that require privileges either P, Q, R or S.

How do you do this?

© Stack Overflow or respective owner

Related posts about sql