happn-3
Version:
pub/sub api as a service using primus and mongo & redis or nedb, can work as cluster, single process or embedded using nedb
19 lines (18 loc) • 463 B
JavaScript
module.exports = class PermissionsStore {
constructor() {
this.stored = {};
}
static create() {
return new PermissionsStore();
}
get(permissionKey, userId) {
return (this.stored[permissionKey] && this.stored[permissionKey][userId]) || null;
}
set(permissionKey, userId, data) {
this.stored[permissionKey] = this.stored[permissionKey] || {};
this.stored[permissionKey][userId] = data;
}
clear() {
this.stored = {};
}
};