/[LeafOK_CVS]/lbbs/include/user_priv.h
ViewVC logotype

Diff of /lbbs/include/user_priv.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 by sysadm, Tue May 6 05:31:26 2025 UTC Revision 1.4 by sysadm, Fri May 30 02:56:02 2025 UTC
# Line 50  struct user_priv Line 50  struct user_priv
50          {          {
51                  int sid;                  int sid;
52                  int s_priv;                  int s_priv;
53                    int is_favor;
54          } s_priv_list[BBS_max_section];          } s_priv_list[BBS_max_section];
55          int s_count;          int s_count;
56  };  };
# Line 58  typedef struct user_priv BBS_user_priv; Line 59  typedef struct user_priv BBS_user_priv;
59    
60  extern BBS_user_priv BBS_priv;  extern BBS_user_priv BBS_priv;
61    
62  extern int checklevel(BBS_user_priv *p_priv, int level);  // Check whether user level matches any bit in the given param
63    inline int checklevel(BBS_user_priv *p_priv, int level)
64  extern int setpriv(BBS_user_priv *p_priv, int sid, int priv);  {
65            if (level == P_GUEST)
66            {
67                    return 1;
68            }
69    
70  extern int getpriv(BBS_user_priv *p_priv, int sid);          return ((p_priv->level & level) ? 1 : 0);
71    }
72    
73  extern int checkpriv(BBS_user_priv *p_priv, int sid, int priv);  // Check whether user level is equal or greater than the given param
74    inline int checklevel2(BBS_user_priv *p_priv, int level)
75    {
76            return ((p_priv->level >= level) ? 1 : 0);
77    }
78    
79    extern int setpriv(BBS_user_priv *p_priv, int sid, int priv, int is_favor);
80    
81    extern int getpriv(BBS_user_priv *p_priv, int sid, int *p_is_favor);
82    
83    inline int checkpriv(BBS_user_priv *p_priv, int sid, int priv)
84    {
85            int is_favor = 0;
86            return (((getpriv(p_priv, sid, &is_favor) & priv)) == priv ? 1 : 0);
87    }
88    
89    inline int is_favor(BBS_user_priv *p_priv, int sid)
90    {
91            int is_favor = 0;
92            getpriv(p_priv, sid, &is_favor);
93            return is_favor;
94    }
95    
96  extern int load_priv(MYSQL *db, BBS_user_priv *p_priv, long int uid);  extern int load_priv(MYSQL *db, BBS_user_priv *p_priv, long int uid);
97    


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1