feat: gate school administration by organization mode
parent
81b05bf011
commit
9afd17cc68
@ -0,0 +1,23 @@
|
|||||||
|
import request from "@/utils/request";
|
||||||
|
|
||||||
|
export function getCurrentSchoolProductConfig() {
|
||||||
|
return request({
|
||||||
|
url: "/api/school-product-config/current",
|
||||||
|
method: "get",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPlatformSchoolProductConfig(schoolId) {
|
||||||
|
return request({
|
||||||
|
url: `/api/platform-admin/schools/${schoolId}/product-config`,
|
||||||
|
method: "get",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updatePlatformSchoolProductConfig(schoolId, data) {
|
||||||
|
return request({
|
||||||
|
url: `/api/platform-admin/schools/${schoolId}/product-config`,
|
||||||
|
method: "put",
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
const assert = require("assert");
|
||||||
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
const root = path.resolve(__dirname, "..");
|
||||||
|
const api = fs.readFileSync(path.join(root, "src/api/schoolProductConfig.js"), "utf8");
|
||||||
|
const router = fs.readFileSync(path.join(root, "src/router/index.js"), "utf8");
|
||||||
|
const sidebar = fs.readFileSync(path.join(root, "src/layout/components/Sidebar/index.vue"), "utf8");
|
||||||
|
const platformSchool = fs.readFileSync(path.join(root, "src/views/platformAdmin/school/index.vue"), "utf8");
|
||||||
|
|
||||||
|
assert(/\/api\/school-product-config\/current/.test(api), "school users must load their product configuration");
|
||||||
|
assert(/\/product-config`/.test(api), "platform admins must update a school's product configuration");
|
||||||
|
assert(/requiresAdminClass:\s*true/.test(router), "administrative organization routes must be marked for configuration gating");
|
||||||
|
assert(/filterRoutesByOrganizationMode/.test(sidebar), "sidebar must remove unavailable administrative organization routes");
|
||||||
|
assert(/organizationMode/.test(platformSchool) && /updatePlatformSchoolProductConfig/.test(platformSchool), "platform school editor must manage organization mode");
|
||||||
|
|
||||||
|
console.log("School product configuration is represented in the API, routes, sidebar, and platform editor.");
|
||||||
Loading…
Reference in New Issue