CODEX revised with following function: 1. GDS building, 2. different user group with different authority.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
const assert = require('assert');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const root = path.resolve(__dirname, '..');
|
||||
const backend = path.join(root, 'backend');
|
||||
const databasePy = fs.readFileSync(path.join(backend, 'database.py'), 'utf8');
|
||||
const serverPy = fs.readFileSync(path.join(backend, 'server.py'), 'utf8');
|
||||
const dashboardHtml = fs.readFileSync(path.join(root, 'frontend', 'dashboard.html'), 'utf8');
|
||||
|
||||
assert(
|
||||
databasePy.includes('user_group'),
|
||||
'database migration should add users.user_group'
|
||||
);
|
||||
assert(
|
||||
databasePy.includes("'admin'") && databasePy.includes("'manager'"),
|
||||
'admin should be migrated/seeded as manager'
|
||||
);
|
||||
assert(
|
||||
databasePy.includes("'engineer'") && databasePy.includes("'developers'"),
|
||||
'engineer should be migrated/seeded as developers'
|
||||
);
|
||||
assert(
|
||||
serverPy.includes("session['user_group']") || serverPy.includes('session["user_group"]'),
|
||||
'login should store user_group in the session'
|
||||
);
|
||||
assert(
|
||||
serverPy.includes('"user_group"'),
|
||||
'/api/profile should return user_group'
|
||||
);
|
||||
assert(
|
||||
fs.existsSync(path.join(backend, 'pdk_access.py')),
|
||||
'backend/pdk_access.py should resolve role-based PDK roots'
|
||||
);
|
||||
assert(
|
||||
serverPy.includes('pdk_root_for_session'),
|
||||
'server should resolve PDK root per logged-in user group'
|
||||
);
|
||||
assert(
|
||||
dashboardHtml.includes('profile-group'),
|
||||
'dashboard should show read-only profile group information'
|
||||
);
|
||||
assert(
|
||||
!dashboardHtml.includes('profile-group"></select'),
|
||||
'profile group must not be editable'
|
||||
);
|
||||
Reference in New Issue
Block a user