Hi,
It would be possible to implement support for the syntax of mongo and moongose as well and set a way to define everything even with the ui.
Example model:
var mongoose = require("mongoose");
const CREATE = "create";
const READ = "read";
const UPDATE = "update";
const DELETE = "delete";
const actions = [CREATE, READ, UPDATE, DELETE];
const USER = "user";
const GEOAREA = "geo_area";
const APIKEY = "apikey";
const scopes = [USER, GEOAREA, APIKEY];
const apiKeySchema = new mongoose.Schema(
{
owner: {
type: mongoose.Schema.Types.ObjectId,
ref: "User",
required: true,
description: "Owner user"
},
apiKey: String,
expiration: Date,
active: {
type: Boolean,
default: false
},
scopes: [
{
scope: { type: String, enum: scopes },
actions: [{ type: String, enum: actions }]
}
]
},
{
timestamps: true
}
);