internal void MarkModified()
        {
            this.ModifiedTime = DateTime.UtcNow;
            AuthorizationRule revision = this;

            revision.Revision = revision.Revision + (long)1;
        }
        public override bool Equals(object obj)
        {
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }
            AuthorizationRule authorizationRule = (AuthorizationRule)obj;

            if (!string.Equals(this.IssuerName, authorizationRule.IssuerName, StringComparison.OrdinalIgnoreCase) || !string.Equals(this.ClaimType, authorizationRule.ClaimType, StringComparison.OrdinalIgnoreCase) || !string.Equals(this.ClaimValue, authorizationRule.ClaimValue, StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }
            if (this.Rights != null && authorizationRule.Rights == null || this.Rights == null && authorizationRule.Rights != null)
            {
                return(false);
            }
            if (this.Rights == null || authorizationRule.Rights == null)
            {
                return(true);
            }
            HashSet <AccessRights> accessRights  = new HashSet <AccessRights>(this.Rights);
            HashSet <AccessRights> accessRights1 = new HashSet <AccessRights>(authorizationRule.Rights);

            if (accessRights1.Count != accessRights.Count)
            {
                return(false);
            }
            return(accessRights.All <AccessRights>(new Func <AccessRights, bool>(accessRights1.Contains)));
        }
 protected virtual void ValidateRights(IEnumerable <AccessRights> value)
 {
     if (value == null || !value.Any <AccessRights>() || value.Count <AccessRights>() > 3)
     {
         throw new ArgumentException(SRClient.NullEmptyRights(3));
     }
     if (!AuthorizationRule.AreAccessRightsUnique(value))
     {
         throw new ArgumentException(SRClient.CannotHaveDuplicateAccessRights);
     }
 }
 internal void Validate()
 {
     if (this.Rights == null || !this.Rights.Any <AccessRights>() || this.Rights.Count <AccessRights>() > 3)
     {
         throw new InvalidDataContractException(SRClient.NullEmptyRights(3));
     }
     if (!AuthorizationRule.AreAccessRightsUnique(this.Rights))
     {
         throw new InvalidDataContractException(SRClient.CannotHaveDuplicateAccessRights);
     }
     this.OnValidate();
 }
Exemple #5
0
 private ExtendedAuthorizationRule CreateExtendedAuthorizationRule(
     AuthorizationRule rule,
     string namespaceName)
 {
     return(new ExtendedAuthorizationRule()
     {
         Rule = rule,
         Name = rule.KeyName,
         Namespace = namespaceName,
         Permission = rule.Rights.ToList(),
         ConnectionString = GetConnectionString(namespaceName, rule.KeyName)
     });
 }
Exemple #6
0
 private ExtendedAuthorizationRule CreateExtendedAuthorizationRule(
     AuthorizationRule rule,
     string namespaceName,
     string entityName,
     ServiceBusEntityType entityType)
 {
     return(new ExtendedAuthorizationRule()
     {
         Rule = rule,
         Name = rule.KeyName,
         Permission = rule.Rights.ToList(),
         ConnectionString = GetConnectionString(namespaceName, entityName, entityType, rule.KeyName),
         Namespace = namespaceName,
         EntityName = entityName,
         EntityType = entityType
     });
 }
        private ExtendedAuthorizationRule CreateExtendedAuthorizationRule(
            AuthorizationRule rule,
            string namespaceName)
        {
            string connectionString = string.Empty;

            if (IsActiveNamespace(namespaceName))
            {
                connectionString = GetConnectionString(namespaceName, rule.KeyName);
            }

            return new ExtendedAuthorizationRule()
            {
                Rule = rule,
                Name = rule.KeyName,
                Namespace = namespaceName,
                Permission = rule.Rights.ToList(),
                ConnectionString = connectionString
            };
        }
Exemple #8
0
        private ExtendedAuthorizationRule CreateExtendedAuthorizationRule(
            AuthorizationRule rule,
            string namespaceName)
        {
            string connectionString = string.Empty;

            if (IsActiveNamespace(namespaceName))
            {
                connectionString = GetConnectionString(namespaceName, rule.KeyName);
            }

            return(new ExtendedAuthorizationRule()
            {
                Rule = rule,
                Name = rule.KeyName,
                Namespace = namespaceName,
                Permission = rule.Rights.ToList(),
                ConnectionString = connectionString
            });
        }
 private ExtendedAuthorizationRule CreateExtendedAuthorizationRule(
     AuthorizationRule rule,
     string namespaceName,
     string entityName,
     ServiceBusEntityType entityType)
 {
     return new ExtendedAuthorizationRule()
     {
         Rule = rule,
         Name = rule.KeyName,
         Permission = rule.Rights.ToList(),
         ConnectionString = GetConnectionString(namespaceName, entityName, entityType, rule.KeyName),
         Namespace = namespaceName,
         EntityName = entityName,
         EntityType = entityType
     };
 }