示例#1
0
        public void Privilege_Equals_DifferenceInPrivilegeName()
        {
            var other = new Privilege(Id, PrivilegeName + PrivilegeName);

            Assert.IsFalse(_target.Equals(other));
            Assert.IsFalse(other.Equals(_target));
        }
示例#2
0
        public void Privilege_Equals_NoDifferences()
        {
            var other = new Privilege(Id, PrivilegeName);

            Assert.IsTrue(_target.Equals(other));
            Assert.IsTrue(other.Equals(_target));
        }
示例#3
0
        /// <summary>
        /// Verifies whether <see cref="Feature"/> has what access according to
        /// <see cref="Privilege"/>.
        /// </summary>
        /// <param name="privilege"></param>
        /// <param name="features"></param>
        /// <returns></returns>
        public virtual bool?Verify(Privilege privilege, params Feature[] features)
        {
            // TODO: this whole part needs to be worked out...

            // Returning Null means check my parent credential
            if (privilege.Equals(Inherited))
            {
                return(null);
            }
            if (privilege.Equals(NotSet))
            {
                return(null);
            }

            // TODO: return true/false?
            if (privilege.Equals(Allow))
            {
                return(false);
            }

            return(!privilege.Equals(Deny));
        }
示例#4
0
        public override bool Equals(System.Object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            User user = (User)obj;

            return(Email.Equals(user.Email) && Address.Equals(user.Address) &&
                   Profession.Equals(user.Profession) && Privilege.Equals(user.Privilege) &&
                   Username.Equals(user.Username) && GivenName.Equals(user.GivenName) &&
                   Surname.Equals(user.Surname) && Birthdate.Equals(user.Birthdate) &&
                   Gender.Equals(user.Gender) && CultureInfo.Equals(user.CultureInfo) &&
                   City.Equals(user.City) && Country.Equals(user.Country) &&
                   Latitude.Equals(user.Latitude) && Longitude.Equals(user.Longitude));
        }