Source for user.hpp for Part 9

This document shows the contents of user.hpp if you are starting the tutorial in Part 9. Defining the Remaining User Functions.

class User {
   IString UserId;
   virtual IString View()     {return Unauthorized("View");}
   virtual IString ShowAdd()  {return Unauthorized("ShowAdd");}
   virtual IString Add()      {return Unauthorized("Add");}
   virtual IString Complete() {return Unauthorized("Complete");}
   protected:
      Request* Req;
   public:
      User(Request* req) : Req(req),UserId("") {}
      User(): Req(0), UserId("") {}
      IString Action();
      IString LinkFix();
};

class Reader : public User {
      virtual IString View();
   public:
      Reader(Request* req) : User(req) {}
};

class Reviewer: public User {
      virtual IString Add(),
                      ShowAdd(),
                      View();
protected:
   void CreateSections(IString& Content, IBoolean CompleteLink=false);
   // Declare an array of comment sections
   CommentSection* Section;
   int CurCs;
public:
   Reviewer(Request* req) : User(req) {}
};

class Author : public Reviewer {
      virtual IString View(),
                      Complete();
   public:
      Author(Request* req) : Reviewer (req) {}
};