本文整理汇总了C#中Role.Update方法的典型用法代码示例。如果您正苦于以下问题:C# Role.Update方法的具体用法?C# Role.Update怎么用?C# Role.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Role
的用法示例。
在下文中一共展示了Role.Update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetModelPermissions
/*
* Setup mining permissions; for future use
*/
private void SetModelPermissions(Database objDb, MiningModel objModel)
{
// Create a new role and add members
Role newRole = new Role("ModelReader", "ModelReader");
newRole.Members.Add(new RoleMember("redmond\\jamiemac"));
newRole.Members.Add(new RoleMember("redmond\\zhaotang"));
newRole.Members.Add(new RoleMember("redmond\\bogdanc"));
// Add the role to the database and updat
objDb.Roles.Add(newRole);
newRole.Update();
// Create a permission object referring the role
MiningModelPermission newMiningPermision = new MiningModelPermission();
newMiningPermision.Name = "ModelReader";
newMiningPermision.ID = "ModelReader";
newMiningPermision.RoleID = "ModelReader";
// Assign access rights to the permission
newMiningPermision.Read = ReadAccess.Allowed;
newMiningPermision.AllowBrowsing = true;
newMiningPermision.AllowDrillThrough = true;
newMiningPermision.ReadDefinition = ReadDefinitionAccess.Allowed;
// Add permission to the model and update
objModel.MiningModelPermissions.Add(newMiningPermision);
newMiningPermision.Update();
}