Benoit Tellier created JAMES-4190:
-------------------------------------

             Summary: Read only Mailbox annotation
                 Key: JAMES-4190
                 URL: https://issues.apache.org/jira/browse/JAMES-4190
             Project: James Server
          Issue Type: Improvement
          Components: IMAPServer, mailbox
            Reporter: Benoit Tellier


## Why

As an extension writer I need to expose server side computed metadata and I do 
not want IMAP clients to mess up with this.

Propose a modular way to define read only annotation from the IMAP client

## What                                                                         
                                                                                
                                             
   
Some metadata entries are computed server-side and must be exposed to clients 
as read-only: GETMETADATA must return them, but SETMETADATA must respond NO 
with an appropriate error message. Currently    
nothing prevents a client from overwriting any annotation. A modular extension 
point is needed so that any module (quota, ACL, vendor extensions…) can declare 
which annotation keys it owns and are not
client-writable.

## How

Introduce a `ReadOnlyAnnotationPredicate` interface with a single method 
`boolean isReadOnly(MailboxAnnotationKey key).` Modules register 
implementations via Guice multibinding. A composite
AggregatedReadOnlyAnnotationPredicate ORs all registered predicates together 
and is injected into StoreMailboxAnnotationManager. In 
updateAnnotationsReactive(), before canInsertOrUpdate, each incoming
annotation key is tested — a match throws AnnotationException("annotation is 
read-only: <key>"), which SetMetadataProcessor already maps to an IMAP NO 
response. Server-side writers bypass this by
calling AnnotationMapper directly, which is intentional.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to