timApp.sisu package#

Submodules#

timApp.sisu.parse_display_name module#

class timApp.sisu.parse_display_name.SisuDisplayName(coursecode: str, fulldaterange: str, year: str, month: str, day: str, desc: str, period: str | None)[source]#

Bases: object

coursecode: str#
property coursecode_and_time: str#
day: str#
desc: str#
property desc_slug: str#

Returns the group description all-lowercase, spaces replaced with ‘-’ and special characters removed.

fulldaterange: str#
property group_doc_root: str#
month: str#
period: str | None#
property sisugroups_doc_path: str#
year: str#
timApp.sisu.parse_display_name.parse_sisu_group_display_name(s: str) timApp.sisu.parse_display_name.SisuDisplayName | None[source]#

timApp.sisu.scim module#

class timApp.sisu.scim.GetGroupsModel(filter: str)[source]#

Bases: object

filter: str#
class timApp.sisu.scim.SCIMCommonModel(externalId: str, displayName: str)[source]#

Bases: object

displayName: str#
externalId: str#
class timApp.sisu.scim.SCIMEmailModel(value: str, type: str | None = None, primary: bool = True)[source]#

Bases: object

primary: bool = True#
type: str | None = None#
value: str#
exception timApp.sisu.scim.SCIMException(code: int, msg: str, headers: dict[str, str] | None = None)[source]#

Bases: Exception

code: int#
headers: dict[str, str] | None = None#
msg: str#
class timApp.sisu.scim.SCIMGroupModel(externalId: str, displayName: str, members: list[timApp.sisu.scim.SCIMMemberModel], id: str | None = None, schemas: list[str] | None = None)[source]#

Bases: timApp.sisu.scim.SCIMCommonModel

id: str | None = None#
members: list[timApp.sisu.scim.SCIMMemberModel]#
schemas: list[str] | None = None#
class timApp.sisu.scim.SCIMMemberModel(value: str, name: timApp.sisu.scim.SCIMNameModel, display: str, email: str, workEmail: str | None = None, ref: str | None = None, type: str | None = None)[source]#

Bases: object

display: str#
email: str#
property emails: list[str]#
property has_active_email: bool#

Return True if user has any active emails, False otherwise.

..note:: An active email is one that messages can be sent to. Right now Sisu SCIM sets a “nobody+username” email if the user has no valid active emails. These emails should not be set as primary unless the user has no other primary emails at that moment.

Returns

True if the email is valid, False otherwise.

name: timApp.sisu.scim.SCIMNameModel#
property primary_email: str#
ref: str | None = None#
type: str | None = None#
value: str#
workEmail: str | None = None#
class timApp.sisu.scim.SCIMNameModel(familyName: str, givenName: str, middleName: str | None = None)[source]#

Bases: object

derive_full_name(last_name_first: bool) str[source]#
familyName: str#
givenName: str#
middleName: str | None = None#
class timApp.sisu.scim.SCIMUserModel(externalId: str, displayName: str, userName: str, emails: list[timApp.sisu.scim.SCIMEmailModel])[source]#

Bases: timApp.sisu.scim.SCIMCommonModel

emails: list[timApp.sisu.scim.SCIMEmailModel]#
userName: str#
timApp.sisu.scim.check_auth() None[source]#
timApp.sisu.scim.delete_group(group_id: str) flask.wrappers.Response[source]#
timApp.sisu.scim.derive_scim_group_name(s: timApp.sisu.scim.SCIMGroupModel) str[source]#
timApp.sisu.scim.disambiguate_name(derived_name: str) str[source]#
timApp.sisu.scim.get_group(group_id: str) flask.wrappers.Response[source]#
timApp.sisu.scim.get_group_by_scim(group_id: str) timApp.user.usergroup.UserGroup[source]#
timApp.sisu.scim.get_groups(args: timApp.sisu.scim.GetGroupsModel) flask.wrappers.Response[source]#
timApp.sisu.scim.get_scim_id(ug: timApp.user.usergroup.UserGroup) str[source]#
timApp.sisu.scim.get_scim_memberships(ug: timApp.user.usergroup.UserGroup) Any[source]#
timApp.sisu.scim.get_user(user_id: str) flask.wrappers.Response[source]#
timApp.sisu.scim.group_scim(ug: timApp.user.usergroup.UserGroup) dict[source]#
timApp.sisu.scim.handle_error(error: Any) flask.wrappers.Response[source]#
timApp.sisu.scim.handle_error_msg_code(code: int, msg: str, headers: Optional[dict[str, str]] = None) flask.wrappers.Response[source]#
timApp.sisu.scim.is_manually_added(u: timApp.user.user.User) bool[source]#

It is possible to add user manually to SCIM groups. For now we assume that any email user is such.

timApp.sisu.scim.item_locked(error: Exception) flask.wrappers.Response[source]#
timApp.sisu.scim.parse_sisu_group_display_name_or_error(args: timApp.sisu.scim.SCIMGroupModel) timApp.sisu.parse_display_name.SisuDisplayName[source]#
timApp.sisu.scim.post_group(args: timApp.sisu.scim.SCIMGroupModel) flask.wrappers.Response[source]#
timApp.sisu.scim.put_group(group_id: str) flask.wrappers.Response[source]#
timApp.sisu.scim.put_user(user_id: str) flask.wrappers.Response[source]#
timApp.sisu.scim.raise_conflict_error(args: timApp.sisu.scim.SCIMGroupModel, e: sqlalchemy.exc.IntegrityError) None[source]#
timApp.sisu.scim.scim_error_json(code: int, msg: str) dict[source]#
timApp.sisu.scim.scim_group_to_tim(sisu_group: str) str[source]#
timApp.sisu.scim.try_get_group_by_scim(group_id: str) timApp.user.usergroup.UserGroup | None[source]#
timApp.sisu.scim.update_users(ug: timApp.user.usergroup.UserGroup, args: timApp.sisu.scim.SCIMGroupModel) None[source]#

timApp.sisu.scimusergroup module#

class timApp.sisu.scimusergroup.ScimUserGroup(**kwargs)[source]#

Bases: sqlalchemy.ext.declarative.api.Model

property course_id: str#
external_id#
group_id#
property is_administrative_person: bool#
property is_responsible_teacher: bool#
property is_student: bool#
property is_studysubgroup: bool#
property is_teacher: bool#
property without_role: str#

timApp.sisu.sisu module#

class timApp.sisu.sisu.Assessment(userName: str, gradeId: str, completionDate: str, completionCredits: int | None = None, privateComment: str | None = None)[source]#

Bases: object

completionCredits: int | None = None#
completionDate: str#
gradeId: str#
privateComment: str | None = None#
userName: str#
validate_grade(value: str) None[source]#
class timApp.sisu.sisu.AssessmentError(message: str, assessment: timApp.sisu.sisu.CandidateAssessment)[source]#

Bases: object

assessment: timApp.sisu.sisu.CandidateAssessment#
message: str#
class timApp.sisu.sisu.CandidateAssessment(user: timApp.user.user.User, gradeId: Any, completionDate: Any, completionCredits: Any = None, privateComment: Any = None, sentGrade: Any = None, sentCredit: Any = None)[source]#

Bases: object

completionCredits: Any = None#
completionDate: Any#
gradeId: Any#
property is_fail_grade: bool#
property is_passing_grade: bool#
privateComment: Any = None#
sentCredit: Any = None#
sentGrade: Any = None#
to_sisu_json(completion_date: Optional[str] = None, ensure_int_credit: bool = False) dict[str, str][source]#
user: timApp.user.user.User#
class timApp.sisu.sisu.GroupCreateModel(externalId: str, name: str | marshmallow.utils._Missing = <marshmallow.missing>)[source]#

Bases: object

externalId: str#
name: str | marshmallow.utils._Missing = <marshmallow.missing>#
exception timApp.sisu.sisu.IncorrectSettings[source]#

Bases: Exception

class timApp.sisu.sisu.PostAssessmentsBody(assessments: dict[int, dict[str, timApp.sisu.sisu.PostAssessmentsErrorValue]])[source]#

Bases: object

assessments: dict[int, dict[str, timApp.sisu.sisu.PostAssessmentsErrorValue]]#
class timApp.sisu.sisu.PostAssessmentsErrorValue(code: int, reason: str, credits: int | float | marshmallow.utils._Missing = <marshmallow.missing>, gradeId: str | None = None)[source]#

Bases: object

code: int#
credits: int | float | marshmallow.utils._Missing = <marshmallow.missing>#
gradeId: str | None = None#
reason: str#
class timApp.sisu.sisu.PostAssessmentsResponse(body: timApp.sisu.sisu.PostAssessmentsBody | None = None, error: timApp.sisu.sisu.PostAssessmentsErrorValue | None = None)[source]#

Bases: object

body: timApp.sisu.sisu.PostAssessmentsBody | None = None#
error: timApp.sisu.sisu.PostAssessmentsErrorValue | None = None#
class timApp.sisu.sisu.PostGradesModel(destCourse: str, docId: int, dryRun: bool, partial: bool, filterUsers: list[str] | None = None, includeUsers: timApp.util.get_fields.MembershipFilter = <MembershipFilter.All: 'all'>, completionDate: datetime.datetime | None = None, groups: list[str] | None = None)[source]#

Bases: object

completionDate: datetime.datetime | None = None#
destCourse: str#
docId: int#
dryRun: bool#
filterUsers: list[str] | None = None#
groups: list[str] | None = None#
includeUsers: timApp.util.get_fields.MembershipFilter = 'all'#
partial: bool#
exception timApp.sisu.sisu.SisuError[source]#

Bases: Exception

timApp.sisu.sisu.call_sisu_assessments(sisu_id: str, json: dict[str, Any]) requests.models.Response[source]#
timApp.sisu.sisu.create_groups_route(args: list[timApp.sisu.sisu.GroupCreateModel]) flask.wrappers.Response[source]#
timApp.sisu.sisu.create_sisu_document(item_path: str, item_title: str, owner_group: Optional[timApp.user.usergroup.UserGroup] = None) timApp.document.docinfo.DocInfo[source]#
timApp.sisu.sisu.fields_to_assessment(r: timApp.util.get_fields.UserFieldObj, doc: timApp.document.docinfo.DocInfo) timApp.sisu.sisu.CandidateAssessment[source]#
timApp.sisu.sisu.get_assessment_fields_to_save(doc: timApp.document.docinfo.DocInfo, c: timApp.sisu.sisu.CandidateAssessment) dict[str, str][source]#
timApp.sisu.sisu.get_group_prefix(g: timApp.user.usergroup.UserGroup) str | None[source]#

Returns the prefix indicating which Sisu groups the users in this Sisu group shall have access to.

timApp.sisu.sisu.get_potential_groups(u: timApp.user.user.User, course_filter: Optional[str] = None) list[timApp.user.usergroup.UserGroup][source]#

Returns all the Sisu groups that the user shall have access to.

timApp.sisu.sisu.get_potential_groups_route() flask.wrappers.Response[source]#
timApp.sisu.sisu.get_sisu_assessments(sisu_id: str, teacher: timApp.user.user.User, doc: timApp.document.docinfo.DocInfo, groups: list[str] | None, filter_users: list[str] | None, membership_filter: timApp.util.get_fields.MembershipFilter) list[timApp.sisu.sisu.CandidateAssessment][source]#
timApp.sisu.sisu.get_sisu_group_rights(g: timApp.user.usergroup.UserGroup) list[timApp.user.usergroup.UserGroup][source]#
timApp.sisu.sisu.list_reasons(codes: dict[str, timApp.sisu.sisu.PostAssessmentsErrorValue]) Generator[str, None, None][source]#
timApp.sisu.sisu.maybe_to_str(s: Optional[Any]) str | None[source]#
timApp.sisu.sisu.mock_assessments(sisuid: str) flask.wrappers.Response[source]#
timApp.sisu.sisu.post_grades_route(m: timApp.sisu.sisu.PostGradesModel) flask.wrappers.Response[source]#
timApp.sisu.sisu.refresh_sisu_grouplist_doc(ug: timApp.user.usergroup.UserGroup) None[source]#
timApp.sisu.sisu.send_course_group_mail(p: timApp.sisu.parse_display_name.SisuDisplayName, u: timApp.user.user.User) None[source]#
timApp.sisu.sisu.send_grades_to_sisu(sisu_id: str, teacher: timApp.user.user.User, doc: timApp.document.docinfo.DocInfo, partial: bool, dry_run: bool, completion_date: datetime.date | None, filter_users: list[str] | None, groups: list[str] | None, membership_filter: timApp.util.get_fields.MembershipFilter) dict[str, Any][source]#
timApp.sisu.sisu.verify_sisu_assessments() None[source]#

Module contents#