sql,query

I have a table with the following structure:

CREATE TABLE cartconfig_module (
  UserID int(10) unsigned NOT NULL default '0',
  GroupID int(10) unsigned NOT NULL default '0',
  SiteID int(10) unsigned NOT NULL default '0',
  Perms enum('Modify','View','Deny') NOT NULL default 'View',
  LastModified timestamp(14) NOT NULL,
  PRIMARY KEY  (UserID,GroupID,SiteID)
) TYPE=MyISAM;

UsersIDs are from another table, there they have an associated GroupID.

I need all SiteIDs where these conditions are met:

UserID XOR GroupID are not 0, and Perms=View. BUT, if a user's group has
view permissions, and their ID has Deny perms, the SiteID should not be
returned.

To explain that a little more clearly:

Our software first checks a person's group. If that group has
permissions, it checks to see if the person has been explicitly denied
access to the site. If they haven't, then it returns true.

If their group either doesn't have access, or has been denied access,
then it checks to see if the user has explicitly been granted access. If
they have, then it returns true.

In all other cases, it returns false.

I hope this makes sense.

Thanks in advance for any help.





---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to