private void FixupMethodSecurityForInterface(ICatalogCollection coll, Type InterfaceType) { ICatalogObject obj = null; // Look through the interfaces in ifcColl, and find specific interface. Guid iid = Marshal.GenerateGuidForType(InterfaceType); int count = coll.Count(); for (int i = 0; i < count; i++) { ICatalogObject test = (ICatalogObject)(coll.Item(i)); if (new Guid((String)(test.Key())) == iid) { obj = test; break; } } DBG.Assert(obj != null, "Could not find interface " + InterfaceType + " in catalog!"); if (obj != null) { SecurityRoleAttribute attr = new SecurityRoleAttribute("Marshaler", false); attr.Description = Resource.FormatString("Reg_MarshalerDesc"); IConfigurationAttribute confattr = attr as IConfigurationAttribute; DBG.Assert(confattr != null, "SecurityRoleAttribute does not support IConfigurationAttribute!"); // Now, set up the cache to configure this interface: _cache["CurrentTarget"] = "Interface"; _cache["InterfaceCollection"] = coll; _cache["Interface"] = obj; _cache["InterfaceType"] = InterfaceType; // First step, Ensure that the role is here: if (confattr.Apply(_cache)) { coll.SaveChanges(); } // Now, fix up the real roles: if (confattr.AfterSaveChanges(_cache)) { coll.SaveChanges(); } } }
private void FixupMethodSecurityForInterface(ICatalogCollection coll, Type InterfaceType) { ICatalogObject obj2 = null; Guid guid = Marshal.GenerateGuidForType(InterfaceType); int num = coll.Count(); for (int i = 0; i < num; i++) { ICatalogObject obj3 = (ICatalogObject)coll.Item(i); if (new Guid((string)obj3.Key()) == guid) { obj2 = obj3; break; } } if (obj2 != null) { SecurityRoleAttribute attribute = new SecurityRoleAttribute("Marshaler", false) { Description = Resource.FormatString("Reg_MarshalerDesc") }; IConfigurationAttribute attribute2 = attribute; this._cache["CurrentTarget"] = "Interface"; this._cache["InterfaceCollection"] = coll; this._cache["Interface"] = obj2; this._cache["InterfaceType"] = InterfaceType; if (attribute2.Apply(this._cache)) { coll.SaveChanges(); } if (attribute2.AfterSaveChanges(this._cache)) { coll.SaveChanges(); } } }
private void FixupMethodSecurityForInterface(ICatalogCollection coll, Type InterfaceType) { ICatalogObject obj2 = null; Guid guid = Marshal.GenerateGuidForType(InterfaceType); int num = coll.Count(); for (int i = 0; i < num; i++) { ICatalogObject obj3 = (ICatalogObject) coll.Item(i); if (new Guid((string) obj3.Key()) == guid) { obj2 = obj3; break; } } if (obj2 != null) { SecurityRoleAttribute attribute = new SecurityRoleAttribute("Marshaler", false) { Description = Resource.FormatString("Reg_MarshalerDesc") }; IConfigurationAttribute attribute2 = attribute; this._cache["CurrentTarget"] = "Interface"; this._cache["InterfaceCollection"] = coll; this._cache["Interface"] = obj2; this._cache["InterfaceType"] = InterfaceType; if (attribute2.Apply(this._cache)) { coll.SaveChanges(); } if (attribute2.AfterSaveChanges(this._cache)) { coll.SaveChanges(); } } }
/// <summary> /// Parses string representation of SecurityRoleAttribute. /// </summary> /// <param name="roleString">Role definition string.</param> /// <returns>Configured SecurityRoleAttribute instance.</returns> private SecurityRoleAttribute ParseRole(string roleString) { string[] parts = roleString.Split(':'); SecurityRoleAttribute role = new SecurityRoleAttribute(parts[0].Trim()); if (parts.Length > 1) { role.Description = parts[1].Trim(); } if (parts.Length > 2) { role.SetEveryoneAccess = bool.Parse(parts[2].Trim()); } return role; }