Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proppatch_todb(): do not mask the annotations for admins user #3403

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dilyanpalauzov
Copy link
Contributor

Rationale: when an admin user sends PROPPATCH, then the annotations set by the mailbox owner shall be updated. This permits the admin user to modify WebDAV properties without fighting with the annotations database directly or asking for the user’s password.

Admitted, not all cases for PROPPATCH are handled here.

@dilyanpalauzov
Copy link
Contributor Author

The second push enables PROPPATCH by admin users everywhere.

@brong
Copy link
Member

brong commented Aug 29, 2021

Actually, we should probably do this for SEEN state as well - have the admin user always write the seen state as the mailbox owner. I like the idea. Gonna pop it on the team meeting agenda today.

@dilyanpalauzov
Copy link
Contributor Author

Actually, we should probably do this for SEEN state as well - have the admin user always write the seen state as the mailbox owner. I like the idea. Gonna pop it on the team meeting agenda today.

Hello Bron, what happened in the team meeting?

@ksmurchison
Copy link
Contributor

Could up update this to apply cleanly to master?

@ksmurchison ksmurchison self-assigned this Sep 11, 2024
Rationale: when an admin user sends PROPPATCH, then the annotations
set by the mailbox owner shall be updated.  This permits the admin
user to modify WebDAV properties without fighting with the
annotations database directly or asking for the user’s password.
@dilyanpalauzov
Copy link
Contributor Author

This is blocked by #5035 .

@dilyanpalauzov
Copy link
Contributor Author

I have updated the changes for the tip of the master branch.

In my eyes it is not pleasant when I contribute some code, then time passes until I for sure forget all the context, then the changes are reviewed and only then any form of questions appear. Asking me to change the code anyhow is a form of question. I have forgotten all the context and have to start anew.

That said, these changes work only when fastmailsharing is enabled - #5035 - and only affect the WebDAV code. For JMAP such logic will probably be useful, too.

While looking now on the code, I see in http_caldav.c:caldav_mkcol(), http_carddav.c:_create_mailbox(), and caldav_util.c:_create_mailbox() calls to annotate_state_writemask(…, userid, … ). I think it will be more meaningful to use there instead annotate_state_write(…, "" for userid, …);.

In the same sense, I think in proppatch_scheddefault instead of

-                r = annotate_state_writemask(astate, annotname, httpd_userid, &pctx->buf);
+                r = annotate_state_writemask(astate, annotname, httpd_userisadmin ? "" : httpd_userid, &pctx->buf);

should be

    r = annotate_state_write(astate, annotname, "", &pctx->buf);

dilyanpalauzov added a commit to dilyanpalauzov/cyrus-imapd that referenced this pull request Sep 24, 2024
Rationale: when an admin user sends PROPPATCH, then the annotations
set by the mailbox owner shall be updated.  This permits the admin
user to modify WebDAV properties without fighting with the
annotations database directly or asking for the user’s password.

Admitted, not all cases for PROPPATCH are handled here.

cyrusimap#3403
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants