summaryrefslogtreecommitdiff
path: root/lib/models
diff options
context:
space:
mode:
Diffstat (limited to 'lib/models')
-rw-r--r--lib/models/note.js6
-rw-r--r--lib/models/user.js11
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/models/note.js b/lib/models/note.js
index 132f8b1e..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", "locked", "private"];
+var permissionTypes = ["freely", "editable", "limited", "locked", "protected", "private"];
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
+};
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;
},