Skip to content

Commit f6d7936

Browse files
authored
Merge pull request #11 from adentes-org/develop
UP Master
2 parents d3a172b + ac7848a commit f6d7936

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

assets/js/db.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ define(["pouchdb"], function(PouchDB) { //Load all page JS scripts
2424
console.log(err);
2525
});
2626
},
27-
createSecurity : function(db) {
27+
createSecurity : function(db,dbname) {
2828
return db.request({
2929
method: "PUT",
3030
url: '_security',
3131
body: {
3232
"admins":{"names":[],"roles":[]},
33-
"members":{"names":[],"roles":["equipier"]} //TODO use a custom equipier role based on dbname
33+
"members":{"names":[],"roles":["equipier","equipier-"+dbname]} //TODO remove common equipier role after complete migration
3434
}
3535
});
3636
},
@@ -40,6 +40,7 @@ define(["pouchdb"], function(PouchDB) { //Load all page JS scripts
4040
method: "PUT",
4141
url: '_design/sofia-config',
4242
body: {
43+
token : Math.floor((1 + Math.random()) * 0x1000000000000000000).toString(34), //Token generate at creation to dectect new DB with same name as old one
4344
users : [],
4445
config : {
4546
global : {
@@ -65,7 +66,7 @@ define(["pouchdb"], function(PouchDB) { //Load all page JS scripts
6566
}); //Create DB
6667

6768
//Apply secu
68-
db.tools.createSecurity(db.fiches).then(function (result) {
69+
db.tools.createSecurity(db.fiches,dbname).then(function (result) {
6970
return db.tools.createConfig(db.fiches)
7071
}).then(function (result) {
7172
return db.fiches.compact() //Compacting $DB

assets/js/pages/team.js

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ define(["jquery","app/tool"], function($,tool) {
6464
password: $('#add-user input#password').val(),
6565
roles: [
6666
'equipier',
67+
'equipier-'+this.db.config.dbname.fiche,
6768
],
6869
};
6970

0 commit comments

Comments
 (0)