fix: auth role and rename dir
This commit is contained in:
parent
2dd8b2b92d
commit
d5e4cc7315
5 changed files with 13 additions and 5 deletions
|
|
@ -138,7 +138,8 @@ export class CabinetController extends Controller {
|
|||
await esClient.update({
|
||||
index: DEFAULT_INDEX!,
|
||||
id: data._id,
|
||||
doc: { pathname: destination },
|
||||
doc: { pathname: destination, path },
|
||||
refresh: "wait_for",
|
||||
});
|
||||
|
||||
await minioClient.removeObject(DEFAULT_BUCKET!, current.name);
|
||||
|
|
|
|||
|
|
@ -157,7 +157,8 @@ export class DrawerController extends Controller {
|
|||
await esClient.update({
|
||||
index: DEFAULT_INDEX!,
|
||||
id: data._id,
|
||||
doc: { pathname: destination },
|
||||
doc: { pathname: destination, path },
|
||||
refresh: "wait_for",
|
||||
});
|
||||
|
||||
await minioClient.removeObject(DEFAULT_BUCKET!, current.name);
|
||||
|
|
|
|||
|
|
@ -164,7 +164,8 @@ export class FolderController extends Controller {
|
|||
await esClient.update({
|
||||
index: DEFAULT_INDEX!,
|
||||
id: data._id,
|
||||
doc: { pathname: destination },
|
||||
doc: { pathname: destination, path },
|
||||
refresh: "wait_for",
|
||||
});
|
||||
|
||||
await minioClient.removeObject(DEFAULT_BUCKET!, current.name);
|
||||
|
|
|
|||
|
|
@ -165,7 +165,8 @@ export class SubFolderController extends Controller {
|
|||
await esClient.update({
|
||||
index: DEFAULT_INDEX!,
|
||||
id: data._id,
|
||||
doc: { pathname: destination },
|
||||
doc: { pathname: destination, path },
|
||||
refresh: "wait_for",
|
||||
});
|
||||
|
||||
await minioClient.removeObject(DEFAULT_BUCKET!, current.name);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,11 @@ export async function expressAuthentication(
|
|||
throw new HttpError(HttpStatusCode.UNAUTHORIZED, "Invalid token provided.");
|
||||
}
|
||||
|
||||
if (scopes && !scopes.some((v) => payload.resource_access[payload.azp].roles.includes(v))) {
|
||||
if (
|
||||
scopes &&
|
||||
scopes.length > 0 &&
|
||||
scopes.some((v) => !payload.resource_access[payload.azp].roles.includes(v))
|
||||
) {
|
||||
throw new HttpError(HttpStatusCode.FORBIDDEN, "You are not allowed to perform this action.");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue