.agents/skills/opik-backend/permissions.md
Every new JAX-RS endpoint method in apps/opik-backend/src/main/java/com/comet/opik/api/resources/v1/priv/ should be evaluated for a @RequiredPermissions annotation.
Read the current permissions enum at apps/opik-backend/src/main/java/com/comet/opik/infrastructure/auth/WorkspaceUserPermission.java.
Check if the endpoint's resource already uses @RequiredPermissions on other methods. If sibling methods have permissions, the new endpoint likely needs one too.
Logically match the endpoint's operation to a permission. Do not rely on naming patterns — reason about what the endpoint does and which permission governs that action:
If a logically matching permission exists, do NOT add it automatically. Instead, inform the user which permission you believe matches and why, then ask for confirmation before adding the @RequiredPermissions annotation.
If no matching permission exists, inform the user:
@GET
@Path("/{id}")
@RequiredPermissions(WorkspaceUserPermission.DATASET_VIEW)
public Response getDatasetById(@PathParam("id") UUID id) { ... }
Not all resources have permissions defined yet. The remaining endpoints rely on team-membership authentication. This is expected. Do not add permissions speculatively; only add them when a logically matching WorkspaceUserPermission value exists or the user confirms a new one should be created.
Full permissions spec: https://www.notion.so/cometml/Workspace-permissions-and-user-roles-management-2b77124010a380f8b526e7ecb235c419