コード例 #1
0
        protected override uint GetPassword(string identity, string @namespace, out byte[] password, out long passwordSalt, out UserStatus status, out DateTime?statusTimestamp)
        {
            if (string.IsNullOrWhiteSpace(@namespace))
            {
                @namespace = null;
            }

            ICondition criteria = Utility.GetIdentityCondition(identity);

            if (@namespace != "*" && @namespace != "?" && Mapping.Instance.Namespace != null)
            {
                criteria = criteria.And(Mapping.Instance.Namespace.GetCondition(Mapping.Instance.User, @namespace));
            }

            var user = this.ServiceProvider.GetDataAccess().Select <UserSecret>(Mapping.Instance.User, criteria).FirstOrDefault();

            if (user.UserId == 0)
            {
                password        = null;
                passwordSalt    = 0;
                status          = UserStatus.Active;
                statusTimestamp = null;
            }
            else
            {
                password        = user.Password;
                passwordSalt    = user.PasswordSalt;
                status          = user.Status;
                statusTimestamp = user.StatusTimestamp;
            }

            return(user.UserId);
        }
コード例 #2
0
        protected override IUser GetUser(IIdentityTicket ticket)
        {
            ICondition criteria = Utility.GetIdentityCondition(ticket.Identity);

            if (ticket.Namespace != "*" && ticket.Namespace != "?" && Mapping.Instance.Namespace != null)
            {
                criteria = criteria.And(Mapping.Instance.Namespace.GetCondition(Mapping.Instance.User, ticket.Namespace));
            }

            return(this.ServiceProvider.GetDataAccess().Select <User>(Mapping.Instance.User, criteria).FirstOrDefault());
        }
コード例 #3
0
        protected virtual DataRow[] FindRowsByPrimaryKeys(DataRow row, DataTable compareTable)
        {
            Guard.ArgumentIsNotNull(CompareKeys, nameof(CompareKeys));

            ICondition filter = null;

            foreach (var col in CompareKeys)
            {
                var con = new ValueCondition(col.Column, CompareOperation.Equals, GetValue(col, row));
                filter = filter == null ? con : filter.And(con);
            }

            return(compareTable.Select(DataTableExpressionRender.BuildCondition(filter)));
        }