feat: get jaccount from sjtu email
This commit is contained in:
parent
179c1e0649
commit
1c90f55013
|
@ -79,9 +79,13 @@ class Gitea:
|
||||||
|
|
||||||
@lru_cache()
|
@lru_cache()
|
||||||
def _get_username_by_canvas_student(self, student: User) -> str:
|
def _get_username_by_canvas_student(self, student: User) -> str:
|
||||||
if student.integration_id is None:
|
if (
|
||||||
raise Exception(f"{student} id not found in Gitea")
|
student.email is not None
|
||||||
return student.integration_id
|
and student.email.count("@") == 1
|
||||||
|
and student.email.endswith("@sjtu.edu.cn")
|
||||||
|
):
|
||||||
|
return student.email.split("@")[0]
|
||||||
|
raise Exception(f"Can not get username of {student}, an SJTU email is expected")
|
||||||
|
|
||||||
def add_canvas_students_to_teams(
|
def add_canvas_students_to_teams(
|
||||||
self, students: PaginatedList, team_names: List[str]
|
self, students: PaginatedList, team_names: List[str]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user