]> code.citadel.org Git - citadel.git/blobdiff - citadel/user_ops.c
Move user privileges functions to user_ops.c, room access check functions to room_ops.c
[citadel.git] / citadel / user_ops.c
index f7cb7493870456c61d6eed7434531ce9849e5b35..7c7e226a779bb26b9198ce11b030ca97df025d1d 100644 (file)
@@ -369,7 +369,30 @@ void MailboxName(char *buf, size_t n, const struct ctdluser *who, const char *pr
 
 
 /*
- * Is the user currently logged in an Aide?
+ * Check to see if the specified user has Internet mail permission
+ * (returns nonzero if permission is granted)
+ */
+int CtdlCheckInternetMailPermission(struct ctdluser *who) {
+
+       /* Do not allow twits to send Internet mail */
+       if (who->axlevel <= AxProbU) return(0);
+
+       /* Globally enabled? */
+       if (config.c_restrict == 0) return(1);
+
+       /* User flagged ok? */
+       if (who->flags & US_INTERNET) return(2);
+
+       /* Admin level access? */
+       if (who->axlevel >= AxAideU) return(3);
+
+       /* No mail for you! */
+       return(0);
+}
+
+
+/*
+ * Is the user currently logged in an Admin?
  */
 int is_aide(void)
 {
@@ -381,7 +404,7 @@ int is_aide(void)
 
 
 /*
- * Is the user currently logged in an Aide *or* the room aide for this room?
+ * Is the user currently logged in an Admin *or* the room Admin for this room?
  */
 int is_room_aide(void)
 {
@@ -1589,7 +1612,7 @@ int CtdlInvtKick(char *iuser, int op) {
 void cmd_invt_kick(char *iuser, int op) {
 
        /*
-        * These commands are only allowed by aides, room aides,
+        * These commands are only allowed by admins, room admins,
         * and room namespace owners
         */
        if (is_room_aide()) {
@@ -1632,7 +1655,7 @@ void cmd_kick(char *iuser) {cmd_invt_kick(iuser, 0);}
 int CtdlForgetThisRoom(void) {
        visit vbuf;
 
-       /* On some systems, Aides are not allowed to forget rooms */
+       /* On some systems, Admins are not allowed to forget rooms */
        if (is_aide() && (config.c_aide_zap == 0)
           && ((CC->room.QRflags & QR_MAILBOX) == 0)  ) {
                return(1);