Add API tokens management
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Pierre HUBERT 2024-04-20 11:35:26 +02:00
parent 43382991eb
commit ff35da5639

View File

@ -471,6 +471,76 @@ export function TokenRightsEditor(p: {
</Table>
</RightsSection>
{/* API tokens */}
<RightsSection label="API tokens">
<RouteRight
{...p}
right={{ verb: "POST", path: "/api/tokens/create" }}
label="Create a new API token"
/>
<RouteRight
{...p}
right={{ verb: "GET", path: "/api/tokens/list" }}
label="Get list of API tokens"
/>
</RightsSection>
{/* API tokens management */}
<RightsSection label="API tokens management">
<Table size="small">
<TableHead>
<TableRow>
<TableCell>API token name</TableCell>
<TableCell align="center">Get</TableCell>
<TableCell align="center">Update</TableCell>
<TableCell align="center">Delete</TableCell>
</TableRow>
</TableHead>
<TableBody>
{/* All API tokens operations */}
<TableRow hover>
<TableCell>
<i>All</i>
</TableCell>
<CellRight
{...p}
right={{ verb: "GET", path: "/api/tokens/*" }}
/>
<CellRight
{...p}
right={{ verb: "PUT", path: "/api/tokens/*" }}
/>
<CellRight
{...p}
right={{ verb: "DELETE", path: "/api/tokens/*" }}
/>
</TableRow>
{/* Per API token operations */}
{p.tokens.map((v, n) => (
<TableRow hover key={n}>
<TableCell>{v.name}</TableCell>
<CellRight
{...p}
right={{ verb: "GET", path: `/api/tokens/${v.id}` }}
parent={{ verb: "GET", path: "/api/tokens/*" }}
/>
<CellRight
{...p}
right={{ verb: "PUT", path: `/api/tokens/${v.id}` }}
parent={{ verb: "PUT", path: "/api/tokens/*" }}
/>
<CellRight
{...p}
right={{ verb: "DELETE", path: `/api/tokens/${v.id}` }}
parent={{ verb: "DELETE", path: "/api/tokens/*" }}
/>
</TableRow>
))}
</TableBody>
</Table>
</RightsSection>
{/* ISO files */}
<RightsSection label="ISO files">
<RouteRight