kvarnerexpress 0 Report post Posted December 25, 2005 I'm working on a piece of user/group authentication and I've run into a question that has to do with ASP coding, I think. I have very little experience with ASP, though.In essence, I have a couple of tables: users, groups, articles, Permissions for articles, and Groupmemberships... So, on a page, it opens up the article and looks for what groups have been given access to the article... It then looks at the userID (session variable) and determines what groups the user belongs to.... you I'll have 2 lists, the groups the user is in and the the groups that have access to the article... If there is any common between the two, then the user has access... otherwise they don't.So...User Group IDs^^^^^^^^^^^Article Group IDs1^^^^^^^^^^^^^^^^^^^33^^^^^^^^^^^^^^^^^^^47^^^^^^^^^^^^^^^^^^^2This person would have permission because the user belongs to one or more groups that have permission...or...User Group IDs^^^^^^^^^^^Article Group IDs1^^^^^^^^^^^^^^^^^^^83^^^^^^^^^^^^^^^^^^^47^^^^^^^^^^^^^^^^^^^2This person would get an access denied error.... So, my question is, how would I compare the two to see if there are any common elements in ASP or SQL? The data is in a MS SQL database...Thanks, Share this post Link to post Share on other sites
kvkv 0 Report post Posted January 30, 2006 You have provided both the tables the same. I am assuming this is your table structure-----------------------------User-group-----------------------------user-id, group-id-----------------------------group-articles-----------------------------group-id, article-idYou can use sql to check the permissions select * from user-group, group-articleswhere user-group.group-id=group-articles.group-idanduser-id=<user id>andarticle-id=<article id> replace <> with actual values. If this query returns results, then the user has permission. Otherwise, he doesn't. Note that it requires only one query. Share this post Link to post Share on other sites