Commit 5158ab37 authored by Curtis Adam's avatar Curtis Adam

Merge branch...

Merge branch '280-use-an-array-instead-of-a-single-string-to-assign-users-by-default-as-admin' into 'staging'

Resolve "Use an array instead of a single string to assign users by default as admin"

Closes #280

See merge request arsnova/cards!629
parents 50e4387e 9902ffef
......@@ -17,7 +17,7 @@ arsnova🍅cards uses Meteor as application framework. Download and install [Met
4. Install the npm package dependencies inside the local repository **"cards folder"** `meteor npm install`
### Settings (These steps are only required if you want to deploy 🍅cards on a server)
1. Set your initial admin user in `settings.json` (cas account)
1. Add the cas id of the admins inside the admin.id array of `settings.json` (cas account)
2. Change `settings.json` according to your needs
> Warning: Never publish your settings file!
......
......@@ -141,20 +141,11 @@ Meteor.users.after.insert(function (userId, doc) {
}
});
if (doc.services !== undefined && doc.services.cas !== undefined) {
if (doc.services.cas.id === Meteor.settings.admin.name) {
Roles.addUsersToRoles(doc._id, [
'standard',
'university',
'admin',
'firstLogin'
]);
} else {
Roles.addUsersToRoles(doc._id, [
'standard',
'university',
'firstLogin'
]);
}
Roles.addUsersToRoles(doc._id, [
'standard',
'university',
'firstLogin'
]);
} else {
Roles.addUsersToRoles(doc._id, ['standard', 'firstLogin']);
}
......
......@@ -257,6 +257,11 @@ const casValidate = (req, ticket, token, service, callback) => {
const userId = Accounts.insertUserDoc({}, options);
user = Meteor.users.findOne(userId);
}
if (Meteor.settings.admin.id.includes(options.services.cas.id)) {
Roles.addUsersToRoles(user._id, ['admin']);
} else {
Roles.removeUsersFromRoles(user._id, ['admin']);
}
if (attrs.debug) {
console.log(`Using user account ${JSON.stringify(user)}`);
}
......
......@@ -28,7 +28,7 @@
"FCM_API_KEY": "AAAAIST6Cb4:APA91bEazKYwihnbcAyqMaX_oNZvNlzoplnCKXpVtBKx-HfGqh9Oof9zufvxvcsINOxIs1guu9cUtXC1YGWFNIAJEDJN_vnc5xMqg1koTJd5bZ5jux3q2Qnstu4kiB_WrbehSPswvw_hIB-q-QNTmH0bVT1YTAXD3A"
},
"admin": {
"name": "hg13345"
"id": []
},
"facebook": {
"api": "162760697401847",
......
......@@ -27,7 +27,7 @@
"BT_PRIVATE_KEY": "b508f71a0e0b01940b0fbe75940debb9"
},
"admin": {
"name": "hg13345"
"id": []
},
"facebook": {
"api": "162760697401847",
......
......@@ -27,7 +27,7 @@
"BT_PRIVATE_KEY": "b508f71a0e0b01940b0fbe75940debb9"
},
"admin": {
"name": "hg13345"
"id": []
},
"facebook": {
"api": "162760697401847",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment