WiP on permissions

Doesn't run. This commit is just to backup the changes.
This commit is contained in:
Tomas Bures 2017-07-26 22:42:05 +03:00
parent 5df444f641
commit 89c9615592
37 changed files with 913 additions and 366 deletions

View file

@ -9,7 +9,7 @@ exports.up = function(knex, Promise) {
table.integer('namespace').unsigned().references('namespaces.id').onDelete('CASCADE');
})
.then(() => knex('namespaces').insert({
id: 1,
id: 1, /* Global namespace id */
name: 'Global',
description: 'Global namespace'
}));
@ -20,7 +20,7 @@ exports.up = function(knex, Promise) {
table.integer('namespace').unsigned().notNullable();
}))
.then(() => knex(`${entityType}s`).update({
namespace: 1
namespace: 1 /* Global namespace id */
}))
.then(() => knex.schema.table(`${entityType}s`, table => {
table.foreign('namespace').references('namespaces.id').onDelete('CASCADE');

View file

@ -21,12 +21,7 @@ exports.up = function(knex, Promise) {
});
}
schema = schema.then(() => knex('shares_namespace').insert({
id: 1,
entity: 1,
user: 1,
role: 'master'
}));
/* The global share for admin is set automatically in rebuild permissions, which is called upon every start */
return schema;
};

View file

@ -4,7 +4,7 @@ exports.up = function(knex, Promise) {
table.string('name');
table.string('password').alter();
})
.then(() => knex('users').where('id', 1).update({
.then(() => knex('users').where('id', 1 /* Admin user id */).update({
name: 'Administrator'
}));
};

View file

@ -0,0 +1,9 @@
exports.up = function(knex, Promise) {
return knex.schema.table('users', table => {
table.string('role');
});
/* The user role is set automatically in rebuild permissions, which is called upon every start */
};
exports.down = function(knex, Promise) {
};