Security Query

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
btd
Posts: 324
Joined: Fri May 13, 2005 1:50 pm

Security Query

Post by btd » Tue Jan 10, 2006 7:43 am

I am trying to query the database for a listing of security rights.

So far I have developed this query. While this seems to work, I found out that if I don't click the repository in the Repository Access list of "Security Settings for Users" tab, my users don't see the Repository in their listing.

So what table is controls if the repository shows up in their list when they log on?

Thanks

Also do you see anything wrong with my query?

SELECT
tblusers.name,
tblrepositories.name as Repository,

case WHEN tblsecurityassignments.securityrights=1 OR tblsecurityassignments.securityrights=3 OR tblsecurityassignments.securityrights=7 THEN 'Y' ELSE 'N' END AS ReadRights,

case WHEN tblsecurityassignments.securityrights=3 OR tblsecurityassignments.securityrights=7 THEN 'Y' ELSE 'N' END AS CheckOutInRights,
case WHEN tblsecurityassignments.securityrights=7 THEN 'Y' ELSE 'N' END AS AddRemoveDeleteRights

FROM
tblsecurityassignments INNER JOIN
tblusers ON tblsecurityassignments.userid = tblusers.userid INNER JOIN
tblrepositories ON tblsecurityassignments.repid = tblrepositories.repid
where tblusers.active = 1

ORDER BY tblusers.name, Repository

ian_sg
Posts: 787
Joined: Wed May 04, 2005 10:55 am
Location: SourceGear
Contact:

Post by ian_sg » Tue Jan 10, 2006 11:40 am

You're looking for tbluserrepositories. The presence of a record with a userid x and repid y indicates that user x sees repository y.
Ian Olsen
SourceGear

Post Reply