Add API tokens support #9

Merged
pierre merged 40 commits from api into master 2024-04-23 17:04:45 +00:00
Showing only changes of commit ff35da5639 - Show all commits

View File

@ -471,6 +471,76 @@ export function TokenRightsEditor(p: {
</Table> </Table>
</RightsSection> </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 */} {/* ISO files */}
<RightsSection label="ISO files"> <RightsSection label="ISO files">
<RouteRight <RouteRight