feat: implement permissions and actions management
- Add permissions logic for status options in corrective actions. - Create tests for permissions functionality. - Implement queries for user authentication and actions management. - Develop Actions page to display and manage corrective actions. - Create authentication pages for login, setup, and password reset. - Add IncidentDetail page to view incident details and associated actions. - Implement Settings page for user management and password changes.
This commit is contained in:
1 parent
708da6b9f7
commit
3f6dff5f24
94 files changed
+7213
-643
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { request } from '@playwright/test'
|
||||
import { baseURL } from '../playwright.config'
|
||||
import { PASSWORD, users } from './fixtures'
|
||||
|
||||
/** Creates the workspace, a site and one user per role in the fresh server. */
|
||||
export default async function globalSetup() {
|
||||
const api = await request.newContext({ baseURL })
|
||||
// oxlint-disable-next-line typescript/no-explicit-any -- loosely typed setup calls
|
||||
const ok = async (res: Awaited<ReturnType<typeof api.post>>): Promise<any> => {
|
||||
if (!res.ok()) throw new Error(`${res.url()} → ${res.status()} ${await res.text()}`)
|
||||
return res.json()
|
||||
}
|
||||
await ok(await api.post('/api/setup', { data: { organizationName: 'E2E Plant', ...users.admin, password: PASSWORD } }))
|
||||
const { site } = await ok(await api.post('/api/sites', { data: { name: 'Main Plant' } }))
|
||||
await ok(await api.post(`/api/sites/${site.id}/areas`, { data: { name: 'Press Shop', kind: 'building' } }))
|
||||
for (const role of ['supervisor', 'reporter'] as const) {
|
||||
await ok(await api.post('/api/users', { data: { ...users[role], role, password: PASSWORD } }))
|
||||
}
|
||||
await api.dispose()
|
||||
}
|
||||
Reference in new issue
Block a user