Esempio n. 1
0
        public Role Handle(RoleByName query)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }

            var internalQuery = new RolesUnfiltered(query.Principal)
            {
                EagerLoad = query.EagerLoad,
            };

            var internalQueryable = _queryProcessor.Execute(internalQuery);

            return(internalQueryable
                   .SingleOrDefault(x => query.Name.Equals(x.Name, StringComparison.OrdinalIgnoreCase))
                   );
        }
Esempio n. 2
0
        public Role Handle(RoleById query)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }

            var internalQuery = new RolesUnfiltered(query.Principal)
            {
                EagerLoad = query.EagerLoad,
            };

            var internalQueryable = _queryProcessor.Execute(internalQuery);

            return(internalQueryable
                   .SingleOrDefault(x => x.RevisionId == query.Id)
                   );
        }
        public Role[] Handle(RolesGrantedToUserId query)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }

            var internalQuery = new RolesUnfiltered(query.Principal)
            {
                EagerLoad = query.EagerLoad,
                OrderBy   = query.OrderBy,
            };

            var internalQueryable = _queryProcessor.Execute(internalQuery);

            return(internalQueryable
                   .Where(x => x.Grants.Any(y => y.User.RevisionId == query.UserId))
                   .ToArray()
                   );
        }
        public Role[] Handle(RolesGrantedToUserName query)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }

            var internalQuery = new RolesUnfiltered(query.Principal)
            {
                EagerLoad = query.EagerLoad,
                OrderBy   = query.OrderBy,
            };

            var internalQueryable = _queryProcessor.Execute(internalQuery);

            return(internalQueryable
                   .Where(x => x.Grants.Any(y => y.User.Name.Equals(query.UserName, StringComparison.OrdinalIgnoreCase)))
                   .ToArray()
                   );
        }