Move user privileges functions to user_ops.c, room access check functions to room_ops.c
[citadel.git] / citadel / user_ops.c
index fd8056559c4ba479eaec5eb8570c63ebf11ca47c..7c7e226a779bb26b9198ce11b030ca97df025d1d 100644 (file)
@@ -368,6 +368,29 @@ void MailboxName(char *buf, size_t n, const struct ctdluser *who, const char *pr
 }
 
 
+/*
+ * 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?
  */