Ejemplo n.º 1
0
        private List <MappingUserToRoleGroupDTO> GetMappingUserToRoleGroups()
        {
            var userToRoleGroupQuery    = new MappingUserToRoleGroupQuery(this.Db);
            var mappingUserToRoleGroups = userToRoleGroupQuery.GetByUserPK(User.User_PK);

            return(mappingUserToRoleGroups.ToList());
        }
Ejemplo n.º 2
0
        private List <RoleDTO> GetRoles(int userPk)
        {
            var roleUserMappings        = mappingUserRoleQuery.GetByUserPK(userPk);
            var roleGroups              = new List <RoleGroupDTO>();
            var mappingRoleToRoleGroups = new List <MappingRoleToRoleGroupDTO>();
            var roles = new List <RoleDTO>();

            foreach (var mapping in roleUserMappings)
            {
                var roleGroup = roleGroupQuery.GetByPrimaryKey((int)mapping.RoleGroup_PK);
                roleGroups.Add(roleGroup);
            }

            foreach (var roleGroup in roleGroups)
            {
                var mappingRoleToRoleGroupRecords = mappingRoleToRoleGroupQuery.GetByRoleGroupPK(roleGroup.RoleGroup_PK);
                foreach (var mappingRoleToRoleGroup in mappingRoleToRoleGroupRecords)
                {
                    mappingRoleToRoleGroups.Add(mappingRoleToRoleGroup);
                }
            }

            foreach (var mappingRoleToRoleGroup in mappingRoleToRoleGroups)
            {
                var role = roleQuery.GetByPrimaryKey((int)mappingRoleToRoleGroup.Role_PK);
                roles.Add(role);
            }

            return(roles);
        }