AMO and AllowedSets -
10-11-2006
, 10:01 AM
Hi,
I'm trying to use AMO to create some roles against an AS 2005 cube.
The following code is pretty much "cut and pasted" from this article on
MSDN.
http://msdn2.microsoft.com/en-us/library/ms345081.aspx
It largely works, in that it creates the role and I can set various
permissions, but importantly for me, the part where you define the
AllowedSet on my Organisation dimension doesn't work. After I run the
script I go to the BI Dev Studio, refresh the db and check the
Dimension Data under my newly created role. All of the child elements
under the "Asset" attribute (level in my hierarchy) are checked, when
I'm expecting to see just one ticked as defined in the set. Has anyone
else attempted this in AMO? I can't find many examples.
The C# code is below.
Thanks
John
Role role = new Role();
role.Name = roleName;
role.Description = desc;
db.Roles.Add(role);
role.Update();
Cube cube = db.Cubes.FindByName(cubeName);
CubePermission cubeperm = cube.CubePermissions.Add(role.ID);
cubeperm.Read = ReadAccess.Allowed;
Dimension dim = db.Dimensions.GetByName("Organisation");
DimensionAttribute attr = dim.Attributes.GetByName("Asset");
CubeDimensionPermission cubedimperm =
cubeperm.DimensionPermissions.Add(dim.ID);
cubedimperm.Read = ReadAccess.Allowed;
AttributePermission attrperm =
cubedimperm.AttributePermissions.Add(attr.ID);
attrperm.AllowedSet = "{[Organisation].[Asset].&[5]}";
cubeperm.Update(); |