fix permissions and teacher attendance workflows

This commit is contained in:
2026-07-10 20:40:52 +08:00
parent 247879f276
commit 8ed1682b90
95 changed files with 4745 additions and 1237 deletions

View File

@@ -0,0 +1,23 @@
import { PRESET_ROLES } from './rbac.service';
describe('preset role permissions', () => {
it('gives teachers explicit workspace permissions without class/schedule delete privileges', () => {
const teacher = PRESET_ROLES.find((role) => role.code === 'teacher');
expect(teacher).toBeDefined();
expect(teacher?.permissionGroups).toEqual(['notification', 'profile']);
expect(teacher?.extraPermissions).toEqual(
expect.arrayContaining([
'student:view',
'class:view',
'schedule:view',
'attendance:view',
'attendance:create',
'attendance:export',
]),
);
expect(teacher?.extraPermissions).not.toEqual(
expect.arrayContaining(['class:delete', 'schedule:delete']),
);
});
});