protected ActionResult RedirectToHome(CoreRole role)
 {
     if (role == CoreRoles.SUPER_ADMIN_ROLE)
     {
         return(Redirect <HomeController>(x => x.SysAdmin(false)));
     }
     if (role == CoreRoles.DISTRICT_ADMIN_ROLE)
     {
         return(Redirect <HomeController>(x => x.DistrictAdmin()));
     }
     if (role == CoreRoles.TEACHER_ROLE)
     {
         return(Redirect <HomeController>(x => x.Teacher()));
     }
     if (role == CoreRoles.STUDENT_ROLE)
     {
         return(Redirect <HomeController>(x => x.Student()));
     }
     if (role == CoreRoles.APP_TESTER_ROLE)
     {
         return(Redirect <HomeController>(x => x.AppTester(false)));
     }
     if (role == CoreRoles.ASSESSMENT_ADMIN_ROLE)
     {
         return(Redirect <HomeController>(x => x.AssessmentAdmin(false)));
     }
     return(Redirect <HomeController>(x => x.Index()));
 }
Exemple #2
0
 public static OAuthUserIdentityInfo Create(string userName, CoreRole role, int?schoolYearId, string sessionKey)
 {
     return(new OAuthUserIdentityInfo
     {
         UserName = userName,
         Role = role,
         SchoolYearId = schoolYearId,
         SessionKey = sessionKey,
     });
 }
        private IEnumerable <Claim> GetUserPermissionClaims(CoreRole role)
        {
            var claims      = new List <Claim>();
            var permissions = _userDm.GetPermissionsByRoleId(role.Id).ToList();

            foreach (var permission in permissions)
            {
                claims.Add(new Claim("Permission", permission.Code));
            }

            return(claims);
        }
Exemple #4
0
        public static RoleViewData Create(CoreRole role)
        {
            var res = new RoleViewData
            {
                Id          = role.Id,
                Name        = role.Name,
                NameLowered = role.LoweredName,
                Description = role.Description
            };

            return(res);
        }
Exemple #5
0
        private static bool ShowRecommended(CoreRole role, IList <StandardVideos> standardVideos)
        {
            if (role == CoreRoles.DISTRICT_ADMIN_ROLE)
            {
                return(false);
            }

            if (standardVideos == null || standardVideos.Count == 0)
            {
                return(false);
            }

            return(true);
        }
Exemple #6
0
 public UserContext(User user, CoreRole role, District district, Data.Master.Model.School school, Guid?developerId, int?personId, int?loginTimeOut, SchoolYear schoolYear = null, string sisRedirectUrl = null)
     : this()
 {
     UserId          = user.Id;
     Login           = user.Login;
     SisTokenExpires = user.LoginInfo.SisTokenExpires;
     SisToken        = user.LoginInfo.SisToken;
     PersonId        = personId;
     Role            = role;
     RoleId          = role.Id;
     DeveloperId     = developerId;
     SisRedirectUrl  = sisRedirectUrl;
     LoginTimeOut    = loginTimeOut;
     if (district != null)
     {
         DistrictId        = district.Id;
         DistrictTimeZone  = district.TimeZone;
         DistrictServerUrl = district.ServerUrl;
         if (string.IsNullOrWhiteSpace(SisRedirectUrl))
         {
             SisRedirectUrl = district.SisRedirectUrl;
         }
         SisUrl = district.SisUrl;
         if (school != null)
         {
             SchoolLocalId = school.LocalId;
             SchoolId      = school.Id;
             SCEnabled     = district.IsDemoDistrict ||
                             school.StudyCenterEnabledTill.HasValue &&
                             school.StudyCenterEnabledTill.Value > NowSchoolTime;
             AssessmentEnabled             = school.IsAssessmentEnabled;
             LEEnabled                     = school.IsLEEnabled;
             LESyncComplete                = school.IsLESyncComplete;
             MessagingDisabled             = school.IsMessagingDisabled;
             StudentMessagingEnabled       = school.StudentMessagingEnabled;
             StudentClassMessagingOnly     = school.StudentToClassMessagingOnly;
             TeacherClassMessagingOnly     = school.TeacherToClassMessagingOnly;
             TeacherStudentMessaginEnabled = school.TeacherToStudentMessaginEnabled;
         }
         if (schoolYear != null)
         {
             SchoolYearId        = schoolYear.Id;
             SchoolYearStartDate = schoolYear.StartDate;
             SchoolYearEndDate   = schoolYear.EndDate;
         }
     }
 }
Exemple #7
0
 public UserContext SwitchToRole(CoreRole role)
 {
     if (role == CoreRoles.DISTRICT_ADMIN_ROLE)
     {
         EnsureDistrictAdminAccess(Context.Claims);
         Context.Role   = role;
         Context.RoleId = role.Id;
         UpdateContext();
         return(Context);
     }
     if (role == CoreRoles.TEACHER_ROLE)
     {
         EnsureTeacherChalkableAccess(Context.Claims);
         Context.Role   = role;
         Context.RoleId = role.Id;
         UpdateContext();
         return(Context);
     }
     throw new NotImplementedException();
 }
Exemple #8
0
        private void SwitchToRole(CoreRole role)
        {
            var context = MasterLocator.UserService.SwitchToRole(role);

            ChalkableAuthentication.SignIn(context, false);
        }
 public UserContext SwitchToRole(CoreRole role)
 {
     throw new NotImplementedException();
 }
Exemple #10
0
 public static StartupViewData Create(IList <StandardVideos> standardVideos, string videoId, int?annAppId, CoreRole role)
 {
     return(new StartupViewData()
     {
         AnnouncementApplicationId = annAppId,
         StandardVideosJson = standardVideos == null ? null : JsonConvert.SerializeObject(standardVideos),
         VideoId = videoId,
         IsRecommendedEnabled = ShowRecommended(role, standardVideos),
         OnlyViewVideo = IsOnlyVideoView(videoId)
     });
 }
Exemple #11
0
 private string GetAccessTokenFor(string userName, int?schoolYearId, CoreRole role)
 {
     throw new NotImplementedException();
 }