refactor: set Student as default portal role for Education
This commit is contained in:
parent
63d8cabb3d
commit
08425d46fa
@ -14,7 +14,7 @@ data = {
|
|||||||
'Student Attendance Tool',
|
'Student Attendance Tool',
|
||||||
'Student Applicant'
|
'Student Applicant'
|
||||||
],
|
],
|
||||||
'default_portal_role': 'LMS User',
|
'default_portal_role': 'Student',
|
||||||
'restricted_roles': [
|
'restricted_roles': [
|
||||||
'Student',
|
'Student',
|
||||||
'Instructor',
|
'Instructor',
|
||||||
|
@ -54,7 +54,7 @@ class Student(Document):
|
|||||||
'send_welcome_email': 1,
|
'send_welcome_email': 1,
|
||||||
'user_type': 'Website User'
|
'user_type': 'Website User'
|
||||||
})
|
})
|
||||||
student_user.add_roles("Student", "LMS User")
|
student_user.add_roles("Student")
|
||||||
student_user.save()
|
student_user.save()
|
||||||
update_password_link = student_user.reset_password()
|
update_password_link = student_user.reset_password()
|
||||||
|
|
||||||
|
@ -9,7 +9,8 @@ from erpnext.setup.utils import insert_record
|
|||||||
|
|
||||||
|
|
||||||
def setup_education():
|
def setup_education():
|
||||||
if frappe.db.exists('Academic Year', '2015-16'):
|
disable_desk_access_for_student_role()
|
||||||
|
if frappe.db.exists("Academic Year", "2015-16"):
|
||||||
# already setup
|
# already setup
|
||||||
return
|
return
|
||||||
create_academic_sessions()
|
create_academic_sessions()
|
||||||
@ -26,3 +27,22 @@ def create_academic_sessions():
|
|||||||
{"doctype": "Academic Term", "academic_year": "2017-18", "term_name": "Semester 2"}
|
{"doctype": "Academic Term", "academic_year": "2017-18", "term_name": "Semester 2"}
|
||||||
]
|
]
|
||||||
insert_record(data)
|
insert_record(data)
|
||||||
|
|
||||||
|
def disable_desk_access_for_student_role():
|
||||||
|
try:
|
||||||
|
student_role = frappe.get_doc("Role", "Student")
|
||||||
|
except frappe.DoesNotExistError:
|
||||||
|
create_student_role()
|
||||||
|
return
|
||||||
|
|
||||||
|
student_role.desk_access = 0
|
||||||
|
student_role.save()
|
||||||
|
|
||||||
|
def create_student_role():
|
||||||
|
student_role = frappe.get_doc({
|
||||||
|
"doctype": "Role",
|
||||||
|
"role_name": "Student",
|
||||||
|
"desk_access": 0,
|
||||||
|
"restrict_to_domain": "Education"
|
||||||
|
})
|
||||||
|
student.insert()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user