old function DoIHavePermissionToDeleteMessagesFromThisRoom() is now a
simple wrapper around CtdlRoomAccess().
* This gives us the ability to query arbitrary room/user combinations, not
just "this user, this room." It also paves the way for the ability to
grant "delete privileges" to any user for any room in the future.
* IMAP ACL now uses this feature to set or clear the "t" flag. Observed
that Thunderbird now activates or deactivates the Delete button for each
folder based on the "t" flag.
/* k - create mailboxes in this hierarchy */
/* t - delete messages (set/clear \Deleted flag) */
/* k - create mailboxes in this hierarchy */
/* t - delete messages (set/clear \Deleted flag) */
+ if (ra & UA_DELETEALLOWED) {
+ strcat(rights, "t");
+ }
/* a - administer (perform SETACL/DELETEACL/GETACL/LISTRIGHTS) */
/* x - delete mailbox (DELETE mailbox, old mailbox name in RENAME) */
/* a - administer (perform SETACL/DELETEACL/GETACL/LISTRIGHTS) */
/* x - delete mailbox (DELETE mailbox, old mailbox name in RENAME) */
#define UA_ZAPPED 16
#define UA_POSTALLOWED 32
#define UA_ADMINALLOWED 64
#define UA_ZAPPED 16
#define UA_POSTALLOWED 32
#define UA_ADMINALLOWED 64
+#define UA_DELETEALLOWED 128
* the current room (returns 1 for yes, 0 for no)
*/
int CtdlDoIHavePermissionToDeleteMessagesFromThisRoom(void) {
* the current room (returns 1 for yes, 0 for no)
*/
int CtdlDoIHavePermissionToDeleteMessagesFromThisRoom(void) {
- getuser(&CC->user, CC->curr_user);
- if ((CC->user.axlevel < 6)
- && (CC->user.usernum != CC->room.QRroomaide)
- && ((CC->room.QRflags & QR_MAILBOX) == 0)
- && (!(CC->internal_pgm))) {
- return(0);
- }
- return(1);
+ int ra;
+ CtdlRoomAccess(&CC->room, &CC->user, &ra, NULL);
+ if (ra & UA_DELETEALLOWED) return(1);
+ return(0);
/*
* Delete message from current room
*/
/*
* Delete message from current room
*/
/* Force the properties of the Aide room */
if (!strcasecmp(roombuf->QRname, config.c_aideroom)) {
if (userbuf->axlevel >= 6) {
/* Force the properties of the Aide room */
if (!strcasecmp(roombuf->QRname, config.c_aideroom)) {
if (userbuf->axlevel >= 6) {
- retval = UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED;
+ retval = UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED | UA_DELETEALLOWED;
}
/* For mailbox rooms, also check the namespace */
}
/* For mailbox rooms, also check the namespace */
+ /* Also, mailbox owners can delete their messages */
if (roombuf->QRflags & QR_MAILBOX) {
if (userbuf->usernum == atol(roombuf->QRname)) {
if (roombuf->QRflags & QR_MAILBOX) {
if (userbuf->usernum == atol(roombuf->QRname)) {
- retval = retval | UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED;
+ retval = retval | UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED | UA_DELETEALLOWED;
}
/* An explicit match means the user belongs in this room */
if (vbuf.v_flags & V_ACCESS) {
}
/* An explicit match means the user belongs in this room */
if (vbuf.v_flags & V_ACCESS) {
- retval = retval | UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED;
+ retval = retval | UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED | UA_DELETEALLOWED;
if ( (userbuf->axlevel >= 6)
|| (userbuf->usernum == roombuf->QRroomaide)
) {
if ( (userbuf->axlevel >= 6)
|| (userbuf->usernum == roombuf->QRroomaide)
) {
- retval = retval | UA_ADMINALLOWED;
+ retval = retval | UA_ADMINALLOWED | UA_DELETEALLOWED;
}
NEWMSG: /* By the way, we also check for the presence of new messages */
}
NEWMSG: /* By the way, we also check for the presence of new messages */