Check type of Vault user / Inventor Addin

Check type of Vault user / Inventor Addin

m_baczewski
Advocate Advocate
205 Views
2 Replies
Message 1 of 3

Check type of Vault user / Inventor Addin

m_baczewski
Advocate
Advocate

Hello,

 

Is it possible to check the type of the logged-in Vault user? I am creating an Inventor add-in to edit the Content Center, and I need to check what type of user is attempting to edit it, because only admin users are allowed to modify the Content Center. I know how to check the connection, but I'm not sure how to verify what type of user is logged in.


0 Likes
Accepted solutions (1)
206 Views
2 Replies
Replies (2)
Message 2 of 3

g.georgiades
Advocate
Advocate
Accepted solution

It is possible - however in order for your code to read permissions for any users running a vault extension or through iLogic/Inventor Addin - you must assign the Administrator User Read Permission to all users. I achieve this in my vault by making a custom Role that I add to all groups.

 

From there you can look at the Autodesk.Connectivity.WebServices.AdminService class in the Vault SDK.

 

Once you get the vault connection object you can get to the AdminService.

 

I have this for getting and checking if the logged in user has permissions.

 

 

userperms = mVltCon.WebServiceManager.AdminService.GetPermissionsByUserId(mVltCon.UserID).Select(a => a.Descr);
if(userperms.Contains("Link Create")) { ...
                    
also

var usr = mVltCon.WebServiceManager.AdminService.GetUserInfoByUserId(mVltCon.UserID);
if(usr.Groups.Select(a => a.Name).Contains("something")) { ...

 

 

 

There are also methods for looking at groups or roles.

 

I recommend using try/catch when accessing permissions otherwise you can get errors if the user doesn't have read permissions.

 

 

ggeorgiades_0-1728493797826.png

 

Message 3 of 3

m_baczewski
Advocate
Advocate
Fantastic, its working very well. That's exactly what I was looking for!
0 Likes