internal static void ApplicationInfo(GenericApplicationParms parms) { if (parms.ApplictionId == null) { throw new InvalidOperationException("Must specify a application"); } foreach (var un in parms.ApplictionId) { var device = m_client.GetApplications(o => o.Name == un).CollectionItem.FirstOrDefault() as SecurityApplicationInfo; if (device == null) { throw new KeyNotFoundException($"Application {un} not found"); } DisplayUtil.PrintPolicies(device, new string[] { "Name", "SID", "Invalid Auth", "Lockout", "Last Auth", "Created", "Updated", "De-Activated" }, u => u.Name, u => u.Key, u => u.InvalidAuthAttempts, u => u.LockoutXml, u => u.LastAuthenticationXml, u => String.Format("{0} ({1})", u.CreationTimeXml, m_client.GetUser(m_client.GetProvenance(u.CreatedByKey.Value).UserKey.Value).Entity.UserName), u => String.Format("{0} ({1})", u.UpdatedTimeXml, m_client.GetUser(m_client.GetProvenance(u.UpdatedByKey.Value).UserKey.Value).Entity.UserName), u => String.Format("{0} ({1})", u.ObsoletionTimeXml, m_client.GetUser(m_client.GetProvenance(u.ObsoletedByKey.Value).UserKey.Value).Entity.UserName) ); } }
internal static void UserInfo(GenericUserParms parms) { if (parms.UserName == null) { throw new InvalidOperationException("Must specify a user"); } foreach (var un in parms.UserName) { var user = m_client.GetUsers(o => o.UserName == un).CollectionItem.FirstOrDefault() as SecurityUserInfo; if (user == null) { throw new KeyNotFoundException($"User {un} not found"); } DisplayUtil.PrintPolicies(user, new string[] { "Name", "SID", "Email", "Phone", "Invalid Logins", "Lockout", "Last Login", "Created", "Updated", "De-Activated", "Roles" }, u => u.UserName, u => u.Key, u => u.Email, u => u.PhoneNumber, u => u.InvalidLoginAttempts, u => u.LockoutXml, u => u.LastLoginTimeXml, u => String.Format("{0} ({1})", u.CreationTimeXml, m_client.GetUser(m_client.GetProvenance(u.CreatedByKey.Value).UserKey.Value).Entity.UserName), u => String.Format("{0} ({1})", u.UpdatedTimeXml, m_client.GetUser(m_client.GetProvenance(u.UpdatedByKey.Value).UserKey.Value).Entity.UserName), u => String.Format("{0} ({1})", u.ObsoletionTimeXml, m_client.GetUser(m_client.GetProvenance(u.ObsoletedByKey.Value).UserKey.Value).Entity.UserName), u => String.Join(" , ", user.Roles) ); } }
internal static void RoleInfo(GenericRoleParms parms) { if (parms.RoleName == null) { throw new InvalidOperationException("Must specify a role"); } var role = m_client.GetRoles(o => o.Name == parms.RoleName).CollectionItem.FirstOrDefault() as SecurityRoleInfo; if (role == null) { throw new KeyNotFoundException($"Role {parms.RoleName} not found"); } DisplayUtil.PrintPolicies(role, new string[] { "Name", "SID", "Description", "Created", "Updated", "De-Activated" }, u => u.Name, u => u.Key, u => u.Description, u => String.Format("{0} ({1})", u.CreationTimeXml, m_client.GetUser(m_client.GetProvenance(u.CreatedByKey.Value).UserKey.Value).Entity.UserName), u => String.Format("{0} ({1})", u.UpdatedTimeXml, m_client.GetUser(m_client.GetProvenance(u.UpdatedByKey.Value).UserKey.Value).Entity.UserName), u => String.Format("{0} ({1})", u.ObsoletionTimeXml, m_client.GetUser(m_client.GetProvenance(u.ObsoletedByKey.Value).UserKey.Value).Entity.UserName) ); }