public SuperAdminLogic(
     UserManager<User> userManager,
     SignInManager<User> signInManager,
     IGenericRepository<User> userRepo,
     IGenericRepository<CourseInfo> coursesInfoRepo,
     ICoursesRepo coursesRepo,
     IHostingEnvironment hostingEnviroment,
     IGenericRepository<Theory> coursesTheory,
     IGenericRepository<TheoryFiles> coursesTheoryFiles,
     IGenericRepository<Tests> tests,
     IGenericRepository<Questions> question,
     IGenericRepository<Answers> answers,
     IGenericRepository<QuestionsAnswers> questionAnswers
     )
 {
     _userManager = userManager;
     _signInManager = signInManager;
     _coursesRepo = coursesRepo;
     _hostingEnviroment = hostingEnviroment;
     _coursesInfoRepo = coursesInfoRepo;
     _coursesTheory = coursesTheory;
     _coursesTheoryFiles = coursesTheoryFiles;
     _tests = tests;
     _question = question;
     _answers = answers;
     _questionAnswers = questionAnswers;
 }
Beispiel #2
0
 public CourseAccessAuthorizationHandler(ICoursesRepo coursesRepo, ICourseRolesRepo courseRolesRepo, IUsersRepo usersRepo, ILogger logger)
     : base(logger)
 {
     this.coursesRepo     = coursesRepo;
     this.courseRolesRepo = courseRolesRepo;
     this.usersRepo       = usersRepo;
 }
Beispiel #3
0
        public async Task <IEnumerable <Course> > GetCoursesAsync(ICoursesRepo coursesRepo)
        {
            if (lastCoursesListFetchTime > DateTime.Now.Subtract(fetchCourseVersionEvery))
            {
                return(base.GetCourses());
            }

            var publishedCourseVersions = await coursesRepo.GetPublishedCourseVersionsAsync().ConfigureAwait(false);

            lastCoursesListFetchTime = DateTime.Now;
            foreach (var courseVersion in publishedCourseVersions)
            {
                try
                {
                    ReloadCourseIfLoadedAndPublishedVersionsAreDifferent(courseVersion.CourseId, courseVersion);
                }
                catch (FileNotFoundException)
                {
                    /* Sometimes zip-archive with course has been deleted already. It's strange but ok */
                    logger.Warning("Это странно, что я не смог загрузить с диска курс, который, если верить базе данных, был опубликован. Но ничего, просто проигнорирую");
                }
            }

            return(base.GetCourses());
        }
Beispiel #4
0
 public CommentsController(ILogger logger, IWebCourseManager courseManager, UlearnDb db,
                           ICommentsRepo commentsRepo, ICommentLikesRepo commentLikesRepo, ICommentPoliciesRepo commentPoliciesRepo,
                           IUsersRepo usersRepo, ICoursesRepo coursesRepo, ICourseRolesRepo courseRolesRepo, INotificationsRepo notificationsRepo,
                           IGroupMembersRepo groupMembersRepo, IGroupAccessesRepo groupAccessesRepo)
     : base(logger, courseManager, db, usersRepo, commentsRepo, commentLikesRepo, coursesRepo, courseRolesRepo, notificationsRepo, groupMembersRepo, groupAccessesRepo)
 {
     this.commentPoliciesRepo = commentPoliciesRepo;
 }
Beispiel #5
0
 public BaseCommentController(ILogger logger, IWebCourseManager courseManager, UlearnDb db, IUsersRepo usersRepo,
                              ICommentsRepo commentsRepo, ICommentLikesRepo commentLikesRepo, ICoursesRepo coursesRepo, ICourseRolesRepo courseRolesRepo, INotificationsRepo notificationsRepo)
     : base(logger, courseManager, db, usersRepo)
 {
     this.commentsRepo      = commentsRepo;
     this.commentLikesRepo  = commentLikesRepo;
     this.coursesRepo       = coursesRepo;
     this.courseRolesRepo   = courseRolesRepo;
     this.notificationsRepo = notificationsRepo;
 }
Beispiel #6
0
 public AccountController(ILogger logger, IOptions <WebApiConfiguration> options, WebCourseManager courseManager, UlearnDb db, UlearnUserManager userManager, SignInManager <ApplicationUser> signInManager,
                          ICourseRolesRepo courseRolesRepo, ICoursesRepo coursesRepo, IUsersRepo usersRepo, ISystemAccessesRepo systemAccessesRepo)
     : base(logger, courseManager, db, usersRepo)
 {
     this.userManager        = userManager;
     this.signInManager      = signInManager;
     this.courseRolesRepo    = courseRolesRepo;
     this.coursesRepo        = coursesRepo;
     this.systemAccessesRepo = systemAccessesRepo;
     this.configuration      = options.Value;
 }
Beispiel #7
0
 public BaseCommentController(IWebCourseManager courseManager, UlearnDb db, IUsersRepo usersRepo,
                              ICommentsRepo commentsRepo, ICommentLikesRepo commentLikesRepo, ICoursesRepo coursesRepo, ICourseRolesRepo courseRolesRepo,
                              INotificationsRepo notificationsRepo, IGroupMembersRepo groupMembersRepo, IGroupAccessesRepo groupAccessesRepo)
     : base(courseManager, db, usersRepo)
 {
     this.commentsRepo      = commentsRepo;
     this.commentLikesRepo  = commentLikesRepo;
     this.coursesRepo       = coursesRepo;
     this.courseRolesRepo   = courseRolesRepo;
     this.notificationsRepo = notificationsRepo;
     this.groupMembersRepo  = groupMembersRepo;
     this.groupAccessesRepo = groupAccessesRepo;
 }
Beispiel #8
0
 public CoursesController(ILogger logger, IWebCourseManager courseManager, UlearnDb db, ICoursesRepo coursesRepo,
                          IUsersRepo usersRepo, ICourseRolesRepo courseRolesRepo, IUnitsRepo unitsRepo, IUserSolutionsRepo solutionsRepo,
                          IUserQuizzesRepo userQuizzesRepo, IVisitsRepo visitsRepo, IGroupsRepo groupsRepo)
     : base(logger, courseManager, db, usersRepo)
 {
     this.coursesRepo     = coursesRepo;
     this.courseRolesRepo = courseRolesRepo;
     this.unitsRepo       = unitsRepo;
     this.solutionsRepo   = solutionsRepo;
     this.userQuizzesRepo = userQuizzesRepo;
     this.visitsRepo      = visitsRepo;
     this.groupsRepo      = groupsRepo;
 }
Beispiel #9
0
 public SlidesController(IWebCourseManager courseManager, UlearnDb db, IUsersRepo usersRepo, ICourseRolesRepo courseRolesRepo,
                         IUserSolutionsRepo solutionsRepo, IUserQuizzesRepo userQuizzesRepo, IVisitsRepo visitsRepo, IGroupsRepo groupsRepo,
                         SlideRenderer slideRenderer, ICoursesRepo coursesRepo)
     : base(courseManager, db, usersRepo)
 {
     this.coursesRepo     = coursesRepo;
     this.courseRolesRepo = courseRolesRepo;
     this.solutionsRepo   = solutionsRepo;
     this.userQuizzesRepo = userQuizzesRepo;
     this.visitsRepo      = visitsRepo;
     this.groupsRepo      = groupsRepo;
     this.slideRenderer   = slideRenderer;
 }
Beispiel #10
0
 public GroupAccessesRepo(
     UlearnDb db,
     IGroupsRepo groupsRepo, ISystemAccessesRepo systemAccessesRepo, ICoursesRepo coursesRepo, IGroupMembersRepo groupMembersRepo,
     IUsersRepo usersRepo,
     ICourseRolesRepo courseRolesRepo,
     IWebCourseManager courseManager
     )
 {
     this.db                 = db;
     this.groupsRepo         = groupsRepo;
     this.systemAccessesRepo = systemAccessesRepo;
     this.coursesRepo        = coursesRepo;
     this.groupMembersRepo   = groupMembersRepo;
     this.courseRolesRepo    = courseRolesRepo;
     this.usersRepo          = usersRepo;
     this.courseManager      = courseManager;
 }
Beispiel #11
0
 public CommentController(IWebCourseManager courseManager, UlearnDb db,
                          IUsersRepo usersRepo, ICommentsRepo commentsRepo, ICommentLikesRepo commentLikesRepo, ICoursesRepo coursesRepo, ICourseRolesRepo courseRolesRepo,
                          INotificationsRepo notificationsRepo, IGroupMembersRepo groupMembersRepo, IGroupAccessesRepo groupAccessesRepo, IVisitsRepo visitsRepo)
     : base(courseManager, db, usersRepo, commentsRepo, commentLikesRepo, coursesRepo, courseRolesRepo, notificationsRepo, groupMembersRepo, groupAccessesRepo, visitsRepo)
 {
 }
Beispiel #12
0
 public CourseAccessAuthorizationHandler(ICoursesRepo coursesRepo, ICourseRolesRepo courseRolesRepo, IUsersRepo usersRepo)
 {
     this.coursesRepo     = coursesRepo;
     this.courseRolesRepo = courseRolesRepo;
     this.usersRepo       = usersRepo;
 }
Beispiel #13
0
 public ContentController(ICoursesRepo courseRepo)
 {
     _courseRepo = courseRepo;
 }
Beispiel #14
0
 public CoursesController(ILogger logger, IWebCourseManager courseManager, UlearnDb db, ICoursesRepo coursesRepo, IUsersRepo usersRepo, ICourseRolesRepo courseRolesRepo)
     : base(logger, courseManager, db, usersRepo)
 {
     this.coursesRepo     = coursesRepo;
     this.courseRolesRepo = courseRolesRepo;
 }
Beispiel #15
0
 public TeachersController(ITeachersRepo repo, ICoursesRepo cRepo)
 {
     this._repo  = repo;
     this._cRepo = cRepo;
 }
Beispiel #16
0
        public static async Task <Func <Slide, string> > BuildGetGitEditLinkFunc(string userId, Course course,
                                                                                 ICourseRolesRepo courseRolesRepo, ICoursesRepo coursesRepo)
        {
            var courseRole = await courseRolesRepo.GetRoleAsync(userId, course.Id);

            var canEditGit = courseRole <= CourseRoleType.CourseAdmin;

            if (!canEditGit)
            {
                return(s => null);
            }
            var publishedCourseVersion = await coursesRepo.GetPublishedCourseVersionAsync(course.Id);

            if (publishedCourseVersion == null)
            {
                return(s => null);
            }
            var repoUrl         = publishedCourseVersion.RepoUrl;
            var pathToCourseXml = publishedCourseVersion.PathToCourseXml;

            if (repoUrl == null || pathToCourseXml == null)
            {
                return(s => null);
            }
            var courseXmlDirectory = course.CourseXmlDirectory;

            return(slide =>
            {
                var pathRelative2CourseXml = slide.Info.SlideFile.FullName.Substring(courseXmlDirectory.FullName.Length + 1);
                return GitUtils.GetSlideEditLink(repoUrl, pathToCourseXml, pathRelative2CourseXml);
            });
        }
Beispiel #17
0
        private readonly SDMSContext _context; // TODO delete

        public AuthController(IAuthRepo repo, ICoursesRepo cRepo, SDMSContext context)
        {
            this._repo    = repo;
            this._cRepo   = cRepo;
            this._context = context; // TODO delete
        }