mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-22 14:49:40 +02:00
feat(frontend): ✨ add group permissions (#721)
* style(frontend): 💄 add darktheme custom * add dummy users in dev mode * feat(frontend): ✨ add group permissions editor UI * feat(backend): ✨ add group permissions setters * test(backend): ✅ tests for basic permission get/set (WIP) Needs more testing * remove old test * chore(backend): copy template.env on setup * feat(frontend): ✨ enable send invitation via email * feat(backend): ✨ enable send invitation via email * feat: ✨ add app config checker for site-settings * refactor(frontend): ♻️ consolidate bool checks Co-authored-by: Hayden <hay-kot@pm.me>
This commit is contained in:
parent
b7b8aa9a08
commit
5d43fac7c9
43 changed files with 652 additions and 106 deletions
|
@ -1,5 +1,5 @@
|
|||
import { BaseCRUDAPI } from "./_base";
|
||||
import { GroupInDB } from "~/types/api-types/user";
|
||||
import { GroupInDB, UserOut } from "~/types/api-types/user";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
|
@ -7,6 +7,8 @@ const routes = {
|
|||
groups: `${prefix}/admin/groups`,
|
||||
groupsSelf: `${prefix}/groups/self`,
|
||||
categories: `${prefix}/groups/categories`,
|
||||
members: `${prefix}/groups/members`,
|
||||
permissions: `${prefix}/groups/permissions`,
|
||||
|
||||
preferences: `${prefix}/groups/preferences`,
|
||||
|
||||
|
@ -56,6 +58,13 @@ export interface Invitation {
|
|||
uses_left: number;
|
||||
}
|
||||
|
||||
export interface SetPermissions {
|
||||
userId: number;
|
||||
canInvite: boolean;
|
||||
canManage: boolean;
|
||||
canOrganize: boolean;
|
||||
}
|
||||
|
||||
export class GroupAPI extends BaseCRUDAPI<GroupInDB, CreateGroup> {
|
||||
baseRoute = routes.groups;
|
||||
itemRoute = routes.groupsId;
|
||||
|
@ -84,4 +93,12 @@ export class GroupAPI extends BaseCRUDAPI<GroupInDB, CreateGroup> {
|
|||
async createInvitation(payload: CreateInvitation) {
|
||||
return await this.requests.post<Invitation>(routes.invitation, payload);
|
||||
}
|
||||
|
||||
async fetchMembers() {
|
||||
return await this.requests.get<UserOut[]>(routes.members);
|
||||
}
|
||||
|
||||
async setMemberPermissions(payload: SetPermissions) {
|
||||
return await this.requests.put<UserOut>(routes.permissions, payload);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue