Пример #1
0
        public async Task <IActionResult> Create()
        {
            //Busca lista de bancos de dados
            List <DatabaseGDR> databasesGDRList = await databaseGDRRepository.GetList(EnableEnum.Enabled);

            ViewBag.DatabaseID = databasesGDRList.Select(x => new SelectListItem
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            }).ToList();

            ViewBag.DatabaseIDSelected = new MultiSelectList(String.Empty, "Text", "Value");


            //Busca lista de grupos de permissões
            List <PermissionGroup> permissionGroupList = await permissionGroupRepository.GetList();

            ViewBag.PermissionGroupID = permissionGroupList.Select(x => new SelectListItem
            {
                Text  = x.GroupName,
                Value = x.Id.ToString()
            }).ToList();

            ViewBag.PermissionGroupIdSelected = new MultiSelectList(String.Empty, "Text", "Value");

            ViewBag.EnableSelect = reportRepository.GetSelectList(EnableEnum.Enabled);


            return(View());
        }
Пример #2
0
        public async Task <IActionResult> Index(bool registroApagado)
        {
            var permissionGroup = await permissionGroupRepository.GetList();

            if (registroApagado)
            {
                ViewBag.RegistroApagado = "<p>Registro apagado com sucesso </p>";
            }

            return(View(permissionGroup));
        }
Пример #3
0
        private async Task <List <Claim> > UserVerifyGroup(String userDN)
        {
            LdapSearchConstraints cons = new LdapSearchConstraints();

            String[] atributos = new String[] { "member" };

            List <Claim> claims           = new List <Claim>();
            var          permissionGroups = await permissionGroupRepository.GetList();

            try
            {
                foreach (PermissionGroup group in permissionGroups)
                {
                    String groupDN = await GetGroupDN(group.GroupName);

                    LdapSearchResults searchResults = ldapConnection.Search(groupDN, LdapConnection.SCOPE_BASE, null, atributos, false, cons);

                    var nextEntry = searchResults.Next();
                    nextEntry.getAttributeSet();

                    try
                    {
                        if (nextEntry.getAttribute("member").StringValueArray.Where(x => x == userDN).Count() > 0)
                        {
                            claims.AddRange(GetClaimType(group.AccessType));
                            claims.Add(new Claim("Reports", group.Id.ToString()));
                        }
                    }
                    catch { }
                }
            }
            catch (Exception error)
            {
                await log.SaveLogApplicationError(controllerName, "Erro ao verificar grupo de segurança: " + error.ToString());
            }

            ldapConnection.Disconnect();

            return(claims);
        }
Пример #4
0
        /// <summary>
        /// 获取权限分组列表
        /// </summary>
        /// <param name="query">查询对象</param>
        /// <returns></returns>
        List <PermissionGroup> GetList(IQuery query)
        {
            var currentPermissionGroupList = permissionGroupRepository.GetList(query);

            return(currentPermissionGroupList);
        }