message: API: Add forUser User.ts schema method
  forUser is a generalization of the specific for* methods and toObject.
  (I.e. forSafe, forTeacher, toObject in ascending authorization order.)
  Its purpose is to restrict access, with the level of access depending
  on the single "otherUser" input parameter.
diff: @@ -18,6 +18,7 @@ interface IUserModel extends IUser, mongoose.Document {
  forSafeBase: () => IUserSubSafeBase;
  forSafe: () => IUserSubSafe;
  forTeacher: () => IUserSubTeacher;
  + forUser: (otherUser: IUser) => IUserSubSafe | IUserSubTeacher | IUser;
  authenticationToken: string;
  resetPasswordToken: string;
  resetPasswordExpires: Date;
  @@ -211,6 +212,18 @@ userSchema.methods.forTeacher = function (): IUserSubTeacher {
  };
  };
  +userSchema.methods.forUser = function (otherUser: IUser): IUserSubSafe | IUserSubTeacher | IUser {
  + const {userIsTeacher, userIsAdmin} = User.checkPrivileges(otherUser);
  + const isSelf = extractMongoId(this._id) === otherUser._id;
  + if (isSelf || userIsAdmin) {
  + return this.toObject();
  + } else if (userIsTeacher) {
  + return this.forTeacher();
  + } else {
  + return this.forSafe();
  + }
  +};
  +
  userSchema.statics.checkPrivileges = function (user: IUser): IProperties {
  const userIsAdmin: boolean = user.role === 'admin';
  const userIsTeacher: boolean = user.role === 'teacher';
  