admin : { 'type' : Boolean, 'default' : false }
});
+UserSchema.virtual( 'sanitized' ).get(function() {
+ var user = {
+ email: this.email,
+ name: this.name,
+ affil: this.affil,
+ showName: this.showName,
+ admin: this.admin
+ }
+
+ return user;
+});
+
UserSchema.virtual( 'displayName' )
.get( function() {
if( this.showName ) {
course : ObjectId
});
+LectureSchema.virtual( 'sanitized' ).get(function() {
+ var lecture = {
+ _id: this._id,
+ name: this.name,
+ date: this.date,
+ live: this.live
+ }
+
+ return lecture;
+})
+
LectureSchema.method( 'authorize', function( user, cb ) {
Course.findById( this.course, function( err, course ) {
if (course) {
collaborators : [String]
});
+NoteSchema.virtual( 'sanitized').get(function() {
+ var note = {
+ _id: this._id,
+ name: this.name,
+ path: this.path,
+ public: this.public,
+ roID: this.roID,
+ visits: this.visits
+ }
+
+ return note;
+});
+
NoteSchema.method( 'authorize', function( user, cb ) {
Lecture.findById( this.lecture, function( err, lecture ) {
if (lecture) {