Added guest
This commit is contained in:
parent
af2c334e66
commit
3d99854c9d
|
@ -1,5 +1,8 @@
|
|||
export enum Permissions {
|
||||
ALL = "*"
|
||||
ALL = "*",
|
||||
VIEW_PROFILE = "view_profile",
|
||||
ADD_PROFILE = "add_profile",
|
||||
MANAGE_PERMISSIONS = "manage_permissions"
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,6 +6,7 @@ import * as sapper from "@sapper/server";
|
|||
import arangojs, { Database, aql } from "arangojs";
|
||||
import { hash } from "bcrypt";
|
||||
import { log } from "./logger";
|
||||
import { Permissions } from "./lib/permissions";
|
||||
|
||||
const { PORT, NODE_ENV, DB_USERNAME, DB_PASSWORD, DB_URL, DB_NAME, API_KEY } =
|
||||
process.env;
|
||||
|
@ -33,7 +34,11 @@ const intervalFunc = async (db: Database) => {
|
|||
username: DB_USERNAME,
|
||||
password: await hash(DB_PASSWORD || "SBDataTracker", saltRounds),
|
||||
forceChangePassword: true,
|
||||
permissions: ["*"]
|
||||
permissions: [Permissions.ALL]
|
||||
});
|
||||
await users.save({
|
||||
username: "_guest",
|
||||
permissions: [Permissions.VIEW_PROFILE]
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -74,6 +79,9 @@ const intervalFunc = async (db: Database) => {
|
|||
);
|
||||
}
|
||||
};
|
||||
// Separated into setInterval and a setTimeout so when the script is started,
|
||||
// immediately at least one profile is logged. This is useful for debugging
|
||||
// since you don't have to wait for up to 3 minutes to pass.
|
||||
if ((cursor.count as number) > 1)
|
||||
interval = setInterval(
|
||||
iterate,
|
||||
|
|
Loading…
Reference in New Issue