parent
f0c1725b44
commit
de79744530
@ -0,0 +1,17 @@
|
||||
import { checkAllowedGroup, readAuthSettings } from "utils/auth/auth-helpers";
|
||||
import { getSettings } from "utils/config/config";
|
||||
|
||||
export default async function handler(req, res) {
|
||||
const { group } = req.query;
|
||||
const { provider, groups } = readAuthSettings(getSettings().auth)
|
||||
|
||||
try {
|
||||
if (checkAllowedGroup(provider.permissions(req), groups, group)) {
|
||||
res.json({ group: group})
|
||||
} else {
|
||||
res.status(401).json({message:"Group unathorized"})
|
||||
}
|
||||
} catch (err) {
|
||||
res.status(500).send("Error authenticating");
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
import { createAuthProvider } from "utils/auth/auth-helpers";
|
||||
import { readAuthSettings } from "utils/auth/auth-helpers";
|
||||
import { bookmarksResponse } from "utils/config/api-response";
|
||||
import { getSettings } from "utils/config/config";
|
||||
|
||||
export default async function handler(req, res) {
|
||||
const auth = createAuthProvider(getSettings())
|
||||
res.send(await bookmarksResponse(auth.permissions(req)));
|
||||
const { provider, groups } = readAuthSettings(getSettings().auth)
|
||||
res.send(await bookmarksResponse(provider.permissions(req), groups));
|
||||
}
|
||||
|
@ -1,14 +1,8 @@
|
||||
import { createAuthProvider } from "utils/auth/auth-helpers";
|
||||
import { readAuthSettings } from "utils/auth/auth-helpers";
|
||||
import { servicesResponse } from "utils/config/api-response";
|
||||
import { getSettings } from "utils/config/config";
|
||||
import createLogger from "utils/logger";
|
||||
|
||||
let logger = createLogger("services_index")
|
||||
|
||||
export default async function handler(req, res) {
|
||||
logger.log("Call services");
|
||||
const auth = createAuthProvider(getSettings)
|
||||
const result = await servicesResponse(auth.permissions(req))
|
||||
logger.log(result);
|
||||
res.send(result);
|
||||
const { provider, groups } = readAuthSettings(getSettings().auth)
|
||||
res.send(await servicesResponse(provider.permissions(req), groups));
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { createAuthProvider } from "utils/auth/auth-helpers";
|
||||
import { readAuthSettings } from "utils/auth/auth-helpers";
|
||||
import { widgetsResponse } from "utils/config/api-response";
|
||||
import { getSettings } from "utils/config/config";
|
||||
|
||||
export default async function handler(req, res) {
|
||||
const auth = createAuthProvider(getSettings());
|
||||
|
||||
res.send(await widgetsResponse(auth.permissions(req)));
|
||||
const { provider } = readAuthSettings(getSettings().auth)
|
||||
res.send(await widgetsResponse(provider.permissions(req)));
|
||||
}
|
||||
|
Loading…
Reference in new issue