public void UpdateHeaderView() { if (Owners.Any()) { CountOfOwners = string.Format(" {0} {1}", Resources.lblFrom, Owners.Count.ToString()); } }
private bool IsCreatorOrOwner(Guid userGuid) { var isCreator = Creator.OwnerGuid.Equals(userGuid); var isOwner = Owners.Any(owner => owner.OwnerGuid.Equals(userGuid)); return(isCreator || isOwner); }
private bool IsOwnerOrManager(Guid userGuid) { var isOwner = Owners.Any(owner => owner.OwnerGuid.Equals(userGuid)); var isManager = Managers.Any(manager => manager.OwnerGuid.Equals(userGuid)); return(isOwner || isManager); }
public void VerifyAppointedBy(Guid wasAppointed, Guid appointer, ICloneableException <Exception> e) { var toRemove = Owners.FirstOrDefault(o => o.OwnerGuid.Equals(wasAppointed)); if (toRemove == null) { toRemove = Managers.FirstOrDefault(m => m.OwnerGuid.Equals(wasAppointed)); } if (toRemove == null) { StackTrace stackTrace = new StackTrace(); var msg = $"User with Guid - {wasAppointed} is not an owner or manager of shop {Guid}" + $" cant complete {stackTrace.GetFrame(1).GetMethod().Name}"; throw e.Clone(msg); } var byCreator = Creator.OwnerGuid.Equals(toRemove.AppointerGuid); var byOwner = Owners.Any(o => o.OwnerGuid.Equals(toRemove.AppointerGuid)); if (!(byCreator || byOwner)) { StackTrace stackTrace = new StackTrace(); var msg = $"User with Guid - {wasAppointed} was not appointed by {appointer}" + $" cant complete {stackTrace.GetFrame(1).GetMethod().Name}"; throw e.Clone(msg); } }
public bool IsOwner(IPrincipal user) { if (user == null || user.Identity == null) { return(false); } return(Owners.Any(u => u.Username == user.Identity.Name)); }
public bool IsOwner(IPrincipal user) { if (user == null || user.Identity == null) { return(false); } return(user.IsInRole(Constants.AdminRoleName) || Owners.Any(u => u.Username == user.Identity.Name)); }
public void VerifyOwnerOrCreator(Guid ownerToRemoveGuid, ICloneableException <Exception> e) { if (!Owners.Any(owner => owner.OwnerGuid.Equals(ownerToRemoveGuid)) && !Creator.OwnerGuid.Equals(ownerToRemoveGuid)) { StackTrace stackTrace = new StackTrace(); var msg = $"User with Guid - {ownerToRemoveGuid} is not an owner" + $" cant complete {stackTrace.GetFrame(1).GetMethod().Name}"; throw e.Clone(msg); } }
public async void BtnRevert() { if (SelectedOwner != null && SelectedOwner.IsNew && Owners.Any()) { SelectedOwner.IsDirty = false; Owners.Remove(SelectedOwner); } else if (SelectedOwner != null && SelectedOwner.IsDirty && !SelectedOwner.IsNew) { await GetOwnerAndUpdateGridAsync(SelectedOwner, false); } }
public override bool Equals(object obj) { if (base.Equals(obj) && obj is TrustedSignerAllowListEntry trustedSigner) { var ownersEquals = (Owners == null || !Owners.Any()) && (trustedSigner.Owners == null || !trustedSigner.Owners.Any()); if (Owners != null && trustedSigner.Owners != null) { ownersEquals = Owners.OrderBy(o => o).SequenceEqual(trustedSigner.Owners.OrderBy(o => o)); } return(AllowUntrustedRoot == trustedSigner.AllowUntrustedRoot && ownersEquals); } return(false); }
public override void WriteYaml(StreamWriter writer, AssetManager assetManager, ILoggerFactory loggerFactory, int indent = 0) { var spaces = "".PadLeft(indent); writer.Write($"{spaces}aks:\n"); spaces = "".PadLeft(indent + 2); writer.Write($"{spaces}clusterName: {ClusterName}\n"); writer.Write($"{spaces}dnsPrefix: {DnsPrefix}\n"); writer.Write($"{spaces}version: {Version}\n"); writer.Write($"{spaces}vmSize: {VmSize}\n"); writer.Write($"{spaces}nodeCount: {NodeCount}\n"); writer.Write($"{spaces}ownerUpn: {AksOwnerAadUpn}\n"); writer.Write($"{spaces}access:\n"); if (Readers?.Any() == true) { spaces = "".PadLeft(indent + 4); writer.Write($"{spaces}readers:"); spaces = "".PadLeft(indent + 6); foreach (var aadIdentity in Readers) { writer.Write($"{spaces}name: {aadIdentity.Name}\n"); writer.Write($"{spaces}type: {aadIdentity.Type}\n"); } } if (Contributors?.Any() == true) { spaces = "".PadLeft(indent + 4); writer.Write($"{spaces}contributors:"); spaces = "".PadLeft(indent + 6); foreach (var aadIdentity in Contributors) { writer.Write($"{spaces}name: {aadIdentity.Name}\n"); writer.Write($"{spaces}type: {aadIdentity.Type}\n"); } } if (Owners?.Any() == true) { spaces = "".PadLeft(indent + 4); writer.Write($"{spaces}owners:"); spaces = "".PadLeft(indent + 6); foreach (var aadIdentity in Owners) { writer.Write($"{spaces}name: {aadIdentity.Name}\n"); writer.Write($"{spaces}type: {aadIdentity.Type}\n"); } } spaces = "".PadLeft(indent + 2); writer.Write($"{spaces}useDevSpaces: {UseDevSpaces}\n"); writer.Write($"{spaces}useTerraform: {UseTerraform}\n"); writer.Write($"{spaces}useIstio: {UseIstio}\n"); writer.Write($"{spaces}useCertManager: {UseCertManager}\n"); if (KeyVaultAccess?.Any() == true) { spaces = "".PadLeft(indent + 2); writer.Write($"{spaces}keyVaultAccess:\n"); foreach (var option in KeyVaultAccess) { spaces = "".PadLeft(indent + 4); writer.Write($"{spaces}- {option}\n"); } } if (Metrics?.Any() == true) { spaces = "".PadLeft(indent + 2); writer.Write($"{spaces}metrics:\n"); foreach (var option in Metrics) { spaces = "".PadLeft(indent + 4); writer.Write($"{spaces}- {option}\n"); } } if (Logging?.Any() == true) { spaces = "".PadLeft(indent + 2); writer.Write($"{spaces}logging:\n"); foreach (var option in Logging) { spaces = "".PadLeft(indent + 4); writer.Write($"{spaces}- {option}\n"); } } if (Tracing?.Any() == true) { spaces = "".PadLeft(indent + 2); writer.Write($"{spaces}tracing:\n"); foreach (var option in Tracing) { spaces = "".PadLeft(indent + 4); writer.Write($"{spaces}- {option}\n"); } } if (Ingress?.Any() == true) { spaces = "".PadLeft(indent + 2); writer.Write($"{spaces}ingress:\n"); foreach (var option in Ingress) { spaces = "".PadLeft(indent + 4); writer.Write($"{spaces}- {option}\n"); } } if (Certs?.Any() == true) { spaces = "".PadLeft(indent + 2); writer.Write($"{spaces}certs:\n"); foreach (var cert in Certs) { spaces = "".PadLeft(indent + 4); writer.Write($"{spaces}- name: {cert.Name}\n"); if (!string.IsNullOrEmpty(cert.Type)) { writer.Write($"{spaces} type: {cert.Type}\n"); } } } if (Secrets != null) { spaces = "".PadLeft(indent + 2); writer.Write($"{spaces}secrets:\n"); spaces = "".PadLeft(indent + 4); writer.Write($"{spaces}addContainerRegistryAccess: {Secrets.AddContainerRegistryAccess}\n"); writer.Write($"{spaces}addKeyVaultAccess: {Secrets.AddKeyVaultAccess}\n"); writer.Write($"{spaces}addAppInsightsKey: {Secrets.AddAppInsightsKey}\n"); } }