MDS API - Set security on entities
-
Tuesday, November 16, 2010 11:43 PM
I'm trying to set security on the entities through the API but receive an error that the identifer must have an existing GUID:
Error code: 500010
Description: "An object identifier is required for model permission operations. The Identifier must have an existing GUID for create, update and clone operations."I have a feeling my flow wrong (do I need to lookup the entity first?). Any suggestions?
Here's my code:
SecurityPrivilegesRequest request = new SecurityPrivilegesRequest(); request.Privileges = new SecurityPrivileges(); ModelPrivilege mp = new ModelPrivilege(); mp.ModelId = new Identifier { Name = "MyModel" }; mp.ObjectId = new Identifier { Name = "MyEntity" }; mp.ObjectType = ModelObjectType.Entity; mp.Permission = Permission.Update; mp.PrincipalType = PrincipalType.Group; Group mdsGroup = new Group(); mdsGroup = new Group(); mdsGroup.GroupType = GroupType.ActiveDirectoryGroup; mdsGroup.Identifier = new Identifier { Name = "myusergroup" }; mp.PrincipalId = mdsGroup.Identifier; request.Privileges.ModelPrivileges.Add(mp); SecurityCreateResponse response = mdsProxy.SecurityPrivilegesCreate(request);
Trevor- Edited by Trevor Iwaszuk Tuesday, November 16, 2010 11:48 PM Updated to remove extra line breaks
All Replies
-
Thursday, November 18, 2010 10:11 AMModerator
Hi Trevor,
The code you posted looks fine.
The error should mean the GUID for the Identifier is not created correctly. Please try to use the following to check if the issue is solved:
ModelPrivilege mp = new ModelPrivilege(); Identifier identify = new Identifier(); identify.Name = "MyModel"; mp.ModelId = identify; identify = new Identifier(); identify.Name = "MyEntity"; mp.ObjectId = identify; mp.ObjectType = ModelObjectType.Entity; mp.Permission = Permission.Update; mp.PrincipalType = PrincipalType.Group;
Thanks,
Jin Chen
Jin Chen - MSFT -
Wednesday, December 01, 2010 7:51 PM
Unfortunately the ObjectId must use the Id (a Guid) in this operation and not the Name so you will need to look up the entity id first.
mp.ObjectId = new Identifier { Id = new Guid("9F4C4267-301A-496C-919A-D5496C117CCD")};
Thanks,
Brian Barnett - MSFT
SQL Server MDS Team
--------------------------------------------------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
-
Thursday, May 16, 2013 6:33 AM
Hi Brian,
I am new to this MDS API programming.
I want to get the user privileges for an entity by giving user name ( Windows user name) as an input. How can i do it ? Could you please help me on this ?
Please reply to my mail : tnr.bala@hotmail.com
Regards,
Bala.R
Bala.R

