Пример #1
0
        private bool CanChangeUserLogin(User user)
        {
            var res = UserSecurity.CanModify(Context, user);

            if (!res && Context.DistrictId.HasValue && user.SisUserId.HasValue && BaseSecurity.IsTeacher(Context))
            {
                int roleId;
                var personId = PersonDataAccess.GetPersonDataForLogin(Context.DistrictServerUrl, Context.DistrictId.Value, user.SisUserId.Value, out roleId);
                if (roleId == CoreRoles.STUDENT_ROLE.Id)
                {
                    var schooLocator = ServiceLocator.SchoolServiceLocator(Context.DistrictId.Value, Context.SchoolLocalId);
                    res = (Context.PersonId.HasValue && Context.SchoolYearId.HasValue &&
                           schooLocator.StudentService.IsTeacherStudent(Context.PersonId.Value, personId, Context.SchoolYearId.Value));
                }
            }
            return(res);
        }