WiP on permissions
Doesn't run. This commit is just to backup the changes.
This commit is contained in:
parent
5df444f641
commit
89c9615592
37 changed files with 913 additions and 366 deletions
|
@ -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');
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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'
|
||||
}));
|
||||
};
|
||||
|
|
9
setup/knex/migrations/20170726155118_create_user_role.js
Normal file
9
setup/knex/migrations/20170726155118_create_user_role.js
Normal 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) {
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue