public static GroupEntityAccessPolicy Get()
        {
            if (!AppUsers.GetCurrent().IsAdministrator)
            {
                return(new GroupEntityAccessPolicy());
            }

            var offices = Offices.GetOffices();
            var roles   = Roles.GetRoles();

            return(new GroupEntityAccessPolicy
            {
                Offices = offices,
                Roles = roles,
                AccessTypes = AccessType.GetAccessTypes(),
                Entities = Entity.GetEntities()
            });
        }
Exemple #2
0
        public static async Task <GroupEntityAccessPolicy> GetAsync(AppUser appUser)
        {
            if (!appUser.IsAdministrator)
            {
                return(new GroupEntityAccessPolicy());
            }

            var offices = await Offices.GetOfficesAsync(appUser.Tenant).ConfigureAwait(false);

            var roles = await Roles.GetRolesAsync(appUser.Tenant).ConfigureAwait(false);

            return(new GroupEntityAccessPolicy
            {
                Offices = offices,
                Roles = roles,
                AccessTypes = AccessType.GetAccessTypes(),
                Entities = await Entity.GetEntitiesAsync(appUser.Tenant).ConfigureAwait(false)
            });
        }
        public static UserEntityAccessPolicy Get()
        {
            if (!AppUsers.GetCurrent().IsAdministrator)
            {
                return(new UserEntityAccessPolicy());
            }

            var offices = Offices.GetOffices();
            var users   = Users.GetUsers();


            return(new UserEntityAccessPolicy
            {
                Offices = offices,
                Users = users,
                AccessTypes = AccessType.GetAccessTypes(),
                Entities = Entity.GetEntities()
            });
        }