Exemplo n.º 1
0
        public GuestRoleProvider(IRoleService roleService, IUnitOfWorkFactory unitOfWorkFactory)
        {
            using (var uow = unitOfWorkFactory.CreateSystem())
            {
                var role = roleService.GetAll(uow).FirstOrDefault(x => x.SystemRole == SystemRole.Base);

                if (role != null)
                {
                    List<Role> roles = role.Roles.SelectRecursive(x => x.Roles).Select(x => x.Item).Distinct().ToList();

                    roles.Add(role);

                    _roles = new List<Role>
                    {
                        new Role
                        {
                            ChildRoles = new List<ChildRole>(),
                            Name = "GustRole",
                            SystemRole = SystemRole.Base,
                            Permissions = roles
                                .SelectMany(m => m.Permissions)
                                .OrderBy(m => m.FullName)
                                .Select(x => new Permission(){
                                    FullName = x.FullName,
                                    AllowRead = x.AllowRead,
                                    AllowWrite = x.AllowWrite,
                                    AllowCreate = x.AllowCreate,
                                    AllowDelete = x.AllowDelete,
                                    AllowNavigate = x.AllowNavigate,
                                }).ToList()
                        }
                    };
                }
            }
        }
Exemplo n.º 2
0
 public EducationService(IExerciseService exerciseService, ICourseCategoryService courseService, IJournalEntryService journalEntryService, IUnitOfWorkFactory unitOfWorkFactory)
 {
     _exerciseService = exerciseService;
     _courseService = courseService;
     _journalEntryService = journalEntryService;
     _systemUnitOfWork = unitOfWorkFactory.CreateSystem();
 }
Exemplo n.º 3
0
 public DefaultAccessPolicy(IUnitOfWorkFactory unitOfWorkFactory)
 {
     _systemUnitOfWork = unitOfWorkFactory.CreateSystem();
 }