public RoleResult SetRoles(IEnumerable <Role> roles) { List <Role> resovedRoles = new List <Role>(); List <RoleUnresolved> unresolvedRoles = new List <RoleUnresolved>(); IList <RoleInfo> roleInfos = _relationService.GetRoleInfos(_relationTypeName); foreach (Role role in roles) { RoleInfo roleInfo = FindRoleInfo(role.Name, roleInfos); if (roleInfo == null) { unresolvedRoles.Add(new RoleUnresolved(role.Name, role.Value, RoleStatus.NoRoleWithName)); } else if (!roleInfo.Writable) { unresolvedRoles.Add(new RoleUnresolved(role.Name, role.Value, RoleStatus.RoleNotWritable)); } else if (!roleInfo.CheckMaxDegree(role.Value.Count)) { unresolvedRoles.Add(new RoleUnresolved(role.Name, role.Value, RoleStatus.MoreThanMaxRoleDegree)); } else if (!roleInfo.CheckMinDegree(role.Value.Count)) { unresolvedRoles.Add(new RoleUnresolved(role.Name, role.Value, RoleStatus.LessThanMinRoleDegree)); } else { _roles[role.Name] = role; resovedRoles.Add(role); } } return(new RoleResult(resovedRoles, unresolvedRoles)); }
internal static bool ValidateRole(IList<ObjectName> value, RoleInfo info, IMBeanServerConnection serverConnection) { return info.CheckMaxDegree(value.Count) && info.CheckMinDegree(value.Count) && CheckRoleClassNames(info, value, serverConnection); }
//private Role(SerializationInfo info, StreamingContext ctx) //{ // info.AddValue("name", _name); // info.AddValue(_value. //} #endregion //#region ISerializable Members //public void GetObjectData(SerializationInfo info, StreamingContext context) //{ // _name = info.GetString("name"); // info.get //} //#endregion #region Internal static interface internal static bool ValidateRole(IList <ObjectName> value, RoleInfo info, IMBeanServerConnection serverConnection) { return(info.CheckMaxDegree(value.Count) && info.CheckMinDegree(value.Count) && CheckRoleClassNames(info, value, serverConnection)); }