Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Query Help

Author  Topic 

mparter
Yak Posting Veteran

86 Posts

Posted - 2002-11-18 : 08:46:18
I have the following tables:

PERMISSIONSMAP
ObjectID
UserID
GroupID
Permission

OBJECTS
ObjectID
Object_Section

GROUPMEMBERS
GroupID
UserID

These work as follows; Details for an object are stored in the OBJECTS table. Members of a group are stored in a GROUPMEMBERS table. If a user is allowed access to an object then an entry will be in the PERMISSIONSMAP table for that object and that user. What I also need to do is, if a group also has permission to access an object, then the query also needs to check to see if the current user is in that group.

It's kinda hard to explain, here's an example.

Bob tries to access Object A, the system checks to see if a record for Bob AND Object A exists in the PERMISSIONSMAP table. Bob might not be in this table individually, but he might be part of a group that DOES have access.

If I simply add the UserID column from the GROUPMEMBERS table then I end up woth two UserID fields and my ASP page trips up at this with a "Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another" error.


Hope this is clear, thanks for any help.

Edited by - mparter on 11/18/2002 08:48:14

mr_mist
Grunnio

1870 Posts

Posted - 2002-11-18 : 08:55:11
SELECT OBJECTID, permission from permissionsmap
where
objectid = @objectid
AND
(
userid = @userid
OR
groupud in
(select groupid from groupmembers
where
userid = @userid)
)

Would get you all permissions associated with a user or his group. Is that what you need?

Go to Top of Page

mparter
Yak Posting Veteran

86 Posts

Posted - 2002-11-18 : 09:00:45
It's OK, there was nothing wrong with my query, it was my code on my ASp page!!

I had adOpenLockReadOnly instead of adLockReadOnly :)

Thanks anyway!
Go to Top of Page
   

- Advertisement -