Beispiel #1
0
        /// <summary>
        ///     Lists the delegated users.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public Task Consume(ConsumeContext <IListDelegatedUsers> context)
        {
            IEnumerable <string> userNames;

            if (!Thread.CurrentPrincipal.IsInRole(WellKnownRoles.Manager))
            {
                userNames = Enumerable.Empty <string>();
            }
            else
            {
                userNames = _databaseContext.DelegatedRights.Filter(x => x.Grantor == Thread.CurrentPrincipal.UserName()).Select(x => x.Grantee);
            }

            return(context.RespondAsync(ListCommand.DelegatedUsersResult(userNames.ToArray())));
        }