committing all group related code

This commit is contained in:
Carter 2025-01-07 10:34:18 -06:00
parent 0ec54b2d31
commit 2d98917322
14 changed files with 541 additions and 102 deletions

View file

@ -15,6 +15,7 @@ export interface IGroupAPIContext {
updateGroup: (id: number, group: pond.GroupSettings) => Promise<any>;
removeGroup: (id: number) => Promise<any>;
getGroup: (id: number) => Promise<any>;
getGroupAndPermissions: (id: number) => Promise<AxiosResponse<pond.GetGroupAndPermissionsResponse>>;
listGroups: (
limit: number,
offset: number,
@ -78,6 +79,27 @@ export default function GroupProvider(props: PropsWithChildren<Props>) {
return get(pondURL("/groups/" + id));
};
const getGroupAndPermissions = (
id: number,
keys?: string[],
types?: string[],
) => {
keys = keys ? keys : getContextKeys();
types = types? types : getContextTypes();
let url = "/groupAndPermissions/" + id
if (as) {
url = url + "?as=" + as +
+
(keys ? "?keys=" + keys.toString() : "") +
(types ? "&types=" + types.toString() : "")
} else {
url = url +
(keys ? "?keys=" + keys.toString() : "") +
(types ? "&types=" + types.toString() : "")
}
return get<pond.GetGroupAndPermissionsResponse>(pondURL(url));
};
const listGroups = (
limit: number,
offset: number,
@ -152,6 +174,7 @@ export default function GroupProvider(props: PropsWithChildren<Props>) {
updateGroup,
removeGroup,
getGroup,
getGroupAndPermissions,
listGroups,
listGroupDevices,
updateGroupPermissions