Easy API Question

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

Moderator: SourceGear

Post Reply
ISBEPRG

Easy API Question

Post by ISBEPRG » Fri Nov 18, 2005 10:37 am

How do I get a list of all of the folder permissions for a given user. This may eventually morph into a report where I can look at the permissions for each user in Vault.

Would it be easier to use the Vault API or create a stored procedure to read data directly from the database?

Thanks

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Post by lbauer » Fri Nov 18, 2005 11:01 am

Similar issue here:
http://support.sourcegear.com/viewtopic.php?p=16740

To get a report on what users' rights are run the following query:

SELECT u.login, s.* FROM sgvault.dbo.ufngetusersecurityrights( SOME_REP_ID, SOME_USER_ID, DEFAULT ) s,
sgvault.dbo.tblusers u WHERE (u.userid = SOME_USER_ID)

As for security rights, it the "sum" of the rights
1 = R (Read)
2 = C (Checkin)
4 = A (Admin)


So a "7" = 1 + 2 + 4
Last edited by lbauer on Tue Jan 10, 2006 2:27 pm, edited 1 time in total.
Linda Bauer
SourceGear
Technical Support Manager

behold
Posts: 43
Joined: Fri Jan 06, 2006 1:00 pm

sql query

Post by behold » Tue Jan 10, 2006 10:12 am

This SQL query doesn't work because the userid column doesn't exist in the function.

Do you have another suggestion?

lbauer
Posts: 9736
Joined: Tue Dec 16, 2003 1:25 pm
Location: SourceGear

Post by lbauer » Tue Jan 10, 2006 2:49 pm

I've edited the query to take out the INNER JOIN. Try again.
Linda Bauer
SourceGear
Technical Support Manager

montek
Posts: 107
Joined: Mon Jan 05, 2004 8:46 am

Post by montek » Wed Jan 25, 2006 4:32 pm

I find this post curious because over a year ago, I was told NOT TO run/create SQL against the vault database and that all use should be strictly left to the API (because the underlying structures could change and break your SQL, etc.). Anyway, I just find it odd that now sourcegear is saying it's okay. =)

jclausius
Posts: 3706
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Post by jclausius » Wed Jan 25, 2006 4:38 pm

montek:

We've never said querying the database was against the rules. For reporting purposes, one of the nice things about Vault is you can gain access to all sorts of information that may not be present in some other form. If you go through this forum, through the years, we've provided queries for people wanting to get additional information directly from the database.

Note, we have said and (still do say), do not MODIFY any data using stored procs or the tables themselves. The Vault server is more than a wrapper around the database, so data modifications need to originate from the Vault API.
Jeff Clausius
SourceGear

Post Reply