From 01361afa7a739f05493ca4a718d6ce5ffe728bc4 Mon Sep 17 00:00:00 2001 From: alecdwm Date: Fri, 6 Jan 2017 05:37:40 +0100 Subject: Profile pictures for LDAP users --- lib/models/user.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/models') diff --git a/lib/models/user.js b/lib/models/user.js index aaf344de..7d27242c 100644 --- a/lib/models/user.js +++ b/lib/models/user.js @@ -7,6 +7,7 @@ var scrypt = require('scrypt'); // core var logger = require("../logger.js"); +var letterAvatars = require('../letter-avatars.js'); module.exports = function (sequelize, DataTypes) { var User = sequelize.define("User", { @@ -105,6 +106,16 @@ module.exports = function (sequelize, DataTypes) { case "google": photo = profile.photos[0].value.replace(/(\?sz=)\d*$/i, '$196'); break; + case "ldap": + //no image api provided, + //use gravatar if email exists, + //otherwise generate a letter avatar + if (profile.emails[0]) { + photo = 'https://www.gravatar.com/avatar/' + md5(profile.emails[0]) + '?s=96'; + } else { + photo = letterAvatars(profile.username); + } + break; } return photo; }, -- cgit v1.2.3 From 89b8ddeabae81fd3a8891ce9d8191fbc9e27c83c Mon Sep 17 00:00:00 2001 From: 蒼時弦也 Date: Tue, 10 Jan 2017 10:02:37 +0800 Subject: Add limited and protected permission --- lib/models/note.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/models') diff --git a/lib/models/note.js b/lib/models/note.js index 132f8b1e..47d9b97a 100644 --- a/lib/models/note.js +++ b/lib/models/note.js @@ -23,7 +23,7 @@ var logger = require("../logger.js"); var ot = require("../ot/index.js"); // permission types -var permissionTypes = ["freely", "editable", "locked", "private"]; +var permissionTypes = ["freely", "editable", "locked", "private", "limited", "protected"]; module.exports = function (sequelize, DataTypes) { var Note = sequelize.define("Note", { @@ -333,7 +333,7 @@ module.exports = function (sequelize, DataTypes) { if (meta.slideOptions && (typeof meta.slideOptions == "object")) _meta.slideOptions = meta.slideOptions; } - return _meta; + return _meta; }, updateAuthorshipByOperation: function (operation, userId, authorships) { var index = 0; @@ -532,4 +532,4 @@ module.exports = function (sequelize, DataTypes) { }); return Note; -}; \ No newline at end of file +}; -- cgit v1.2.3 From 7b02c48d93d05e3ced0a030a13d620559710c9cd Mon Sep 17 00:00:00 2001 From: 蒼時弦也 Date: Tue, 10 Jan 2017 14:13:30 +0800 Subject: Adjust permission order to more clarly --- lib/models/note.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/models') diff --git a/lib/models/note.js b/lib/models/note.js index 47d9b97a..a6921267 100644 --- a/lib/models/note.js +++ b/lib/models/note.js @@ -23,7 +23,7 @@ var logger = require("../logger.js"); var ot = require("../ot/index.js"); // permission types -var permissionTypes = ["freely", "editable", "locked", "private", "limited", "protected"]; +var permissionTypes = ["freely", "editable", "limited", "private", "protected", "locked"]; module.exports = function (sequelize, DataTypes) { var Note = sequelize.define("Note", { -- cgit v1.2.3 From 5f65795e79561f7b787767b7c184f66b65f74c5f Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Thu, 12 Jan 2017 19:04:17 +0800 Subject: Fix permission order and keep wording consistency --- lib/models/note.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/models') diff --git a/lib/models/note.js b/lib/models/note.js index a6921267..86112973 100644 --- a/lib/models/note.js +++ b/lib/models/note.js @@ -23,7 +23,7 @@ var logger = require("../logger.js"); var ot = require("../ot/index.js"); // permission types -var permissionTypes = ["freely", "editable", "limited", "private", "protected", "locked"]; +var permissionTypes = ["freely", "editable", "limited", "locked", "protected", "private"]; module.exports = function (sequelize, DataTypes) { var Note = sequelize.define("Note", { -- cgit v1.2.3