def __create_permissiongroup_if_it_does_not_exist(self): if self.custom_managable_periodpermissiongroup: return self.custom_managable_periodpermissiongroup period = self.request.cradmin_role permissiongroup = PermissionGroup( name="Custom manageable permissiongroup for Period#{}".format(period.id), is_custom_manageable=True, grouptype=PermissionGroup.GROUPTYPE_PERIODADMIN, ) permissiongroup.full_clean() permissiongroup.save() periodpermissiongroup = PeriodPermissionGroup(permissiongroup=permissiongroup, period=period) periodpermissiongroup.full_clean() periodpermissiongroup.save() return periodpermissiongroup
def __create_permissiongroup_if_it_does_not_exist(self): if self.custom_managable_subjectpermissiongroup: return self.custom_managable_subjectpermissiongroup subject = self.request.cradmin_role permissiongroup = PermissionGroup( name="Custom manageable permissiongroup for Subject#{}".format(subject.id), is_custom_manageable=True, grouptype=PermissionGroup.GROUPTYPE_SUBJECTADMIN, ) permissiongroup.full_clean() permissiongroup.save() subjectpermissiongroup = SubjectPermissionGroup(permissiongroup=permissiongroup, subject=subject) subjectpermissiongroup.full_clean() subjectpermissiongroup.save() return subjectpermissiongroup
def __create_permissiongroup_if_it_does_not_exist(self): if self.custom_managable_subjectpermissiongroup: return self.custom_managable_subjectpermissiongroup subject = self.request.cradmin_role permissiongroup = PermissionGroup( name='Custom manageable permissiongroup for Subject#{}'.format( subject.id), is_custom_manageable=True, grouptype=PermissionGroup.GROUPTYPE_SUBJECTADMIN) permissiongroup.full_clean() permissiongroup.save() subjectpermissiongroup = SubjectPermissionGroup( permissiongroup=permissiongroup, subject=subject) subjectpermissiongroup.full_clean() subjectpermissiongroup.save() return subjectpermissiongroup
def __create_permissiongroup_if_it_does_not_exist(self): if self.custom_managable_periodpermissiongroup: return self.custom_managable_periodpermissiongroup period = self.request.cradmin_role permissiongroup = PermissionGroup( name='Custom manageable permissiongroup for Period#{}'.format( period.id), is_custom_manageable=True, grouptype=PermissionGroup.GROUPTYPE_PERIODADMIN) permissiongroup.full_clean() permissiongroup.save() periodpermissiongroup = PeriodPermissionGroup( permissiongroup=permissiongroup, period=period) periodpermissiongroup.full_clean() periodpermissiongroup.save() return periodpermissiongroup