protected string GetUserName(ManagementPackSecureReference sr) { if (sdHash.ContainsKey(sr.Id)) { return(sdHash[sr.Id].ToString()); } if (aasd != null) { return(String.Format(CultureInfo.InvariantCulture, "{0}\\{1}", aasd.Domain, aasd.UserName)); } return("unknown"); }
// This is a bit fragile and relies on current SM 1.0 behaviors // and definitions protected bool GetIsVisible(ManagementPackSecureReference sr) { // bail right away if we don't have any categories if (sr.GetCategories().Count == 0) { return(false); } foreach (ManagementPackCategory c in sr.GetCategories()) { try { string s = _mg.EntityTypes.GetEnumeration(c.Value.Id).Name; // This is fragile - changes in the underlying system can cause // misbehavior if (s == "VisibleToUser") { return(true); } } catch {; } } return(false); }