* CtdlCheckRoomAccess() now sets a new bit UA_ADMINALLOWED
authorArt Cancro <ajc@citadel.org>
Thu, 18 Jan 2007 04:35:52 +0000 (04:35 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 18 Jan 2007 04:35:52 +0000 (04:35 +0000)
  if the user is an Aide or the Room Aide
* Used the above in IMAP ACL...

citadel/imap_acl.c
citadel/ipcdef.h
citadel/room_ops.c

index af497d3d9850499dfdc7b785565bc1e37933a009..dc694ad5b5a3d7a27a2d9f939dda9f4c28a3b868 100644 (file)
@@ -129,41 +129,39 @@ void imap_getacl(int num_parms, char *parms[]) {
                         * r - read (SELECT the mailbox, perform STATUS)
                         * s - keep seen/unseen information across sessions (set or clear \SEEN flag
                         *     via STORE, also set \SEEN during APPEND/COPY/ FETCH BODY[...])
+                        * e - perform EXPUNGE and expunge as a part of CLOSE
                         */
                        if (    (ra & UA_KNOWN)                                 /* known rooms */
                           ||   ((ra & UA_GOTOALLOWED) && (ra & UA_ZAPPED))     /* zapped rooms */
                           ) {
-                                                       strcat(rights, "l");
-                                                       strcat(rights, "r");
-                                                       strcat(rights, "s");
+                               strcat(rights, "l");
+                               strcat(rights, "r");
+                               strcat(rights, "s");
+                               strcat(rights, "e");
+
+                               /* Only output the remaining flags if the room is known */
+
+                               /* w - write (set or clear arbitrary flags; not supported in Citadel) */
+       
+                               /* i - insert (perform APPEND, COPY into mailbox) */
+                               /* p - post (send mail to submission address for mailbox - not enforced) */
+                               if (ra & UA_POSTALLOWED) {
+                                       strcat(rights, "i");
+                                       strcat(rights, "p");
+                               }
+       
+                               /* k - create mailboxes in this hierarchy */
+       
+                               /* t - delete messages (set/clear \Deleted flag) */
+
+                               /* a - administer (perform SETACL/DELETEACL/GETACL/LISTRIGHTS) */
+                               /* x - delete mailbox (DELETE mailbox, old mailbox name in RENAME) */
+                               if (ra & UA_ADMINALLOWED) {
+                                       strcat(rights, "a");
+                                       strcat(rights, "x");
+                               }
                        }
 
-                       /* w - write (set or clear flags other than \SEEN and \DELETED via
-                        * STORE, also set them during APPEND/COPY)
-                        */
-                       /* Never granted in Citadel because our store doesn't support other flags */
-
-                       /* i - insert (perform APPEND, COPY into mailbox)
-                        * p - post (send mail to submission address for mailbox, not enforced by IMAP)
-                        */
-                       if (ra & UA_POSTALLOWED) {
-                                                       strcat(rights, "i");
-                                                       strcat(rights, "p");
-                       }
-
-                       /* k - create mailboxes (CREATE new sub-mailboxes in any
-                        * implementation-defined hierarchy, parent mailbox for the new
-                        * mailbox name in RENAME) */
-
-                       /* x - delete mailbox (DELETE mailbox, old mailbox name in RENAME) */
-
-                       /* t - delete messages (set or clear \DELETED flag via STORE, set
-                        * \DELETED flag during APPEND/COPY) */
-
-                       /* e - perform EXPUNGE and expunge as a part of CLOSE */
-
-                       /* a - administer (perform SETACL/DELETEACL/GETACL/LISTRIGHTS) */
-
                        if (strlen(rights) > 0) {
                                cprintf(" ");
                                imap_strout(temp.fullname);
index 285ae75f0eac0237276db58b3fd3f0c024ec83c8..5e3330c44a96a8f356a3415630b5ae66fe580f29 100644 (file)
@@ -79,6 +79,7 @@ extern "C" {
 #define UA_HASNEWMSGS           8
 #define UA_ZAPPED               16
 #define UA_POSTALLOWED         32
+#define UA_ADMINALLOWED                64
 
 #ifdef __cplusplus
 }
index 66cc9789292a8216a41d2e1ab17bc9a03ae67d47..107cfc64b418a3bb4258c17887b55fa70af7b308 100644 (file)
@@ -166,6 +166,13 @@ void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
                retval = retval | UA_GOTOALLOWED | UA_POSTALLOWED;
        }
 
+       /* Aides and Room Aides have admin privileges */
+       if ( (userbuf->axlevel >= 6)
+          || (userbuf->usernum == roombuf->QRroomaide)
+          ) {
+               retval = retval | UA_ADMINALLOWED;
+       }
+
 NEWMSG:        /* By the way, we also check for the presence of new messages */
        if (is_msg_in_sequence_set(vbuf.v_seen, roombuf->QRhighest) == 0) {
                retval = retval | UA_HASNEWMSGS;