Browse Source

Demo:fix

developer
Erik Römmelt 4 years ago
parent
commit
9e3981a7b1
2 changed files with 3 additions and 3 deletions
  1. 1
    1
      mong_usr.js
  2. 2
    2
      server/authorization.js

+ 1
- 1
mong_usr.js View File

db.users.insert([ db.users.insert([
// User: author, Pwd: author // User: author, Pwd: author
{"_id":"author","name":"Author","type":"PF@EFI;","roles":{"user","author"},"hash":"sha256","salt":"SIzKNsNKsCRVr8a9U90q6A==","pwd":"HZly68TSAKHioz6Kz0QCbXVTHpT6hMmabUbFYVlCMeE=","abos":[],"bookmarks":[]},
{"_id":"author","name":"Author","type":"PF@EFI;","roles":{"user":true,"author":true},"hash":"sha256","salt":"SIzKNsNKsCRVr8a9U90q6A==","pwd":"HZly68TSAKHioz6Kz0QCbXVTHpT6hMmabUbFYVlCMeE=","abos":[],"bookmarks":[]},
// User: admin, Pwd: SwenMho // User: admin, Pwd: SwenMho
// {"_id":"admin","name":"Test Admin","type":"MA@AMP;","roles":'{"user":true,"author":true,"admin":true}',"hash":"sha256","salt":"z3PNXGmQaWvaT7m2ZlT+0w==","pwd":"nfUfNv032J745xj3Hzya3Mkk43Dz/H0BmNTZhtx8UM0=","abos":["veniam","ipsum"],"bookmarks":[],}, // {"_id":"admin","name":"Test Admin","type":"MA@AMP;","roles":'{"user":true,"author":true,"admin":true}',"hash":"sha256","salt":"z3PNXGmQaWvaT7m2ZlT+0w==","pwd":"nfUfNv032J745xj3Hzya3Mkk43Dz/H0BmNTZhtx8UM0=","abos":["veniam","ipsum"],"bookmarks":[],},
]) ])

+ 2
- 2
server/authorization.js View File



// Return user role, query from found.mail // Return user role, query from found.mail
function getUserRole(found) { function getUserRole(found) {
var roles = "user";
var roles = "user:true";
var mail = found.mail; var mail = found.mail;
if (!/\d/.test(mail)) { if (!/\d/.test(mail)) {
// Mail contains no number // Mail contains no number
roles += ',"author"';
roles += ',"author:true"';
} }
return ('{'+roles+'}'); return ('{'+roles+'}');
} }

Loading…
Cancel
Save