Exemplo n.º 1
0
        public async Task <Role> CheckPublicRole(IRoleDal roleDal, IRoleCategoryDal roleCategoryDal)
        {
            var publicRole = await roleDal.GetAsync(x => x.Name.ToLower() == "public");

            if (publicRole == null)
            {
                var checkRoleCategory = await roleCategoryDal.GetAsync(x => x.Name.ToLower() == "public");

                if (checkRoleCategory == null)
                {
                    checkRoleCategory = new RoleCategory
                    {
                        Name        = "Users",
                        Description = "Kullanıcı ile ilgili yetkiler"
                    };

                    await roleCategoryDal.Add(checkRoleCategory);
                }

                var role = new Role
                {
                    Name           = "Public",
                    RoleCategoryId = checkRoleCategory.Id,
                    Description    = "Public Kullanıcı Yetkileri.."
                };

                await roleDal.Add(role);
            }

            return(await roleDal.GetAsync(x => x.Name.ToLower() == "public"));
        }
Exemplo n.º 2
0
 public UserManager(IUserDal userDal, IRoleDal roleDal, IRoleCategoryDal roleCategoryDal,
                    IAnnounceStatusCheck announceStatusCheck,
                    IMapper mapper,
                    IUserRoleDal userRoleDal)
 {
     this.userRoleDal         = userRoleDal;
     this.mapper              = mapper;
     this.roleDal             = roleDal;
     this.roleCategoryDal     = roleCategoryDal;
     this.announceStatusCheck = announceStatusCheck;
     this.userDal             = userDal;
 }
Exemplo n.º 3
0
 public RoleCategoryManager(IRoleCategoryDal roleCategoryDal, IMapper mapper)
 {
     this.mapper          = mapper;
     this.roleCategoryDal = roleCategoryDal;
 }