summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorAkuket <32392661+Akuket@users.noreply.github.com>2018-10-16 11:46:21 +0200
committerGitHub <noreply@github.com>2018-10-16 11:46:21 +0200
commit50edffee47edf94f4f3aa21e5030354a33acf3d6 (patch)
treebc92da43c179b9bc88cd34b0c92c8938007a3517 /models
parent41330b15dccfdd45c08b2657833a0bcba9576243 (diff)
parent3dcebe8a9eb6ef96fc8a6a42dc1a1ce7a2a4d98c (diff)
downloadwekan-50edffee47edf94f4f3aa21e5030354a33acf3d6.tar.gz
wekan-50edffee47edf94f4f3aa21e5030354a33acf3d6.tar.bz2
wekan-50edffee47edf94f4f3aa21e5030354a33acf3d6.zip
Merge branch 'edge' into edge
Diffstat (limited to 'models')
-rw-r--r--models/cards.js23
-rw-r--r--models/users.js8
2 files changed, 27 insertions, 4 deletions
diff --git a/models/cards.js b/models/cards.js
index 66bfbcf3..25692c25 100644
--- a/models/cards.js
+++ b/models/cards.js
@@ -1304,6 +1304,29 @@ if (Meteor.isServer) {
cardRemover(userId, doc);
});
}
+//SWIMLANES REST API
+if (Meteor.isServer) {
+ JsonRoutes.add('GET', '/api/boards/:boardId/swimlanes/:swimlaneId/cards', function(req, res) {
+ const paramBoardId = req.params.boardId;
+ const paramSwimlaneId = req.params.swimlaneId;
+ Authentication.checkBoardAccess(req.userId, paramBoardId);
+ JsonRoutes.sendResult(res, {
+ code: 200,
+ data: Cards.find({
+ boardId: paramBoardId,
+ swimlaneId: paramSwimlaneId,
+ archived: false,
+ }).map(function(doc) {
+ return {
+ _id: doc._id,
+ title: doc.title,
+ description: doc.description,
+ listId: doc.listId,
+ };
+ }),
+ });
+ });
+}
//LISTS REST API
if (Meteor.isServer) {
JsonRoutes.add('GET', '/api/boards/:boardId/lists/:listId/cards', function(req, res) {
diff --git a/models/users.js b/models/users.js
index 31d5cf60..4f2184e4 100644
--- a/models/users.js
+++ b/models/users.js
@@ -495,7 +495,7 @@ if (Meteor.isServer) {
user.emails = [{ address: email, verified: true }];
const initials = user.services.oidc.fullname.match(/\b[a-zA-Z]/g).join('').toUpperCase();
user.profile = { initials, fullname: user.services.oidc.fullname };
- user['authenticationMethod'] = 'oauth2';
+ user.authenticationMethod = 'oauth2';
// see if any existing user has this email address or username, otherwise create new
const existingUser = Meteor.users.findOne({$or: [{'emails.address': email}, {'username':user.username}]});
@@ -508,7 +508,7 @@ if (Meteor.isServer) {
existingUser.emails = user.emails;
existingUser.username = user.username;
existingUser.profile = user.profile;
- existingUser['authenticationMethod'] = user['authenticationMethod'];
+ existingUser.authenticationMethod = user.authenticationMethod;
Meteor.users.remove({_id: existingUser._id}); // remove existing record
return existingUser;
@@ -523,7 +523,7 @@ if (Meteor.isServer) {
// If ldap, bypass the inviation code if the self registration isn't allowed.
// TODO : pay attention if ldap field in the user model change to another content ex : ldap field to connection_type
if (options.ldap || !disableRegistration) {
- user['authenticationMethod'] = 'ldap';
+ user.authenticationMethod = 'ldap';
return user;
}
@@ -643,7 +643,7 @@ if (Meteor.isServer) {
const disableRegistration = Settings.findOne().disableRegistration;
// If ldap, bypass the inviation code if the self registration isn't allowed.
// TODO : pay attention if ldap field in the user model change to another content ex : ldap field to connection_type
- if (doc['authenticationMethod'] !== 'ldap' && disableRegistration) {
+ if (doc.authenticationMethod !== 'ldap' && disableRegistration) {
const invitationCode = InvitationCodes.findOne({code: doc.profile.icode, valid: true});
if (!invitationCode) {
throw new Meteor.Error('error-invitation-code-not-exist');