Exemple #1
0
        public async Task <IEnumerable <Permission> > GetPermissions(string grain, string securableItem = null, string permissionName = null)
        {
            var customParams = grain + securableItem + permissionName;

            return(permissionName != null ?
                   await DocumentDbService.GetDocuments <Permission>("permissions", "byname", customParams) :
                   await DocumentDbService.GetDocuments <Permission>("permissions", "bysecitem", customParams));
        }
Exemple #2
0
        public async Task <IEnumerable <Role> > GetRoles(string grain, string securableItem = null, string roleName = null)
        {
            var customParams = grain + securableItem + roleName;

            return(roleName != null ?
                   await DocumentDbService.GetDocuments <Role>("roles", "byname", customParams) :
                   await DocumentDbService.GetDocuments <Role>("roles", "bysecitem", customParams));
        }
        public override async Task <Group> Get(string id)
        {
            try
            {
                return(await base.Get(FormatId(id)).ConfigureAwait(false));
            }
            catch (NotFoundException <Group> )
            {
                Logger.Debug($"Exact match for Group {id} not found.");

                // now attempt to find a group that starts with the supplied ID
                var groups = await DocumentDbService.GetDocuments <Group>(GetGroupIdPrefix(id));

                var activeGroup = groups.FirstOrDefault(g => !g.IsDeleted);
                if (activeGroup == null)
                {
                    throw new NotFoundException <Group>($"Could not find {typeof(Group).Name} entity with ID {id}");
                }

                return(activeGroup);
            }
        }
 public override async Task <IEnumerable <Group> > GetAll()
 {
     return(await DocumentDbService.GetDocuments <Group>("group"));
 }