コード例 #1
0
        internal void MarkModified()
        {
            this.ModifiedTime = DateTime.UtcNow;
            AuthorizationRule revision = this;

            revision.Revision = revision.Revision + (long)1;
        }
コード例 #2
0
        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)));
        }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 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();
 }
コード例 #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)
     });
 }
コード例 #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
     });
 }
コード例 #7
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
            };
        }
コード例 #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
            });
        }
コード例 #9
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
     };
 }