Skip to content

settings: current-tenant settings write surface for tenant owners, validate TENANT scope_id #382

Description

@antosubash

Why

Replaces #368, filed before #370. Since #370, tenant roles map only onto tenants.* permissions, so anyone holding settings.edit is a platform operator. That operator legitimately edits system scope and any tenant's scope. The real gaps are:

  1. A tenant owner cannot edit their own tenant's settings. tenants.settings.manage exists but nothing uses it.
  2. The platform routes accept any scope_id for TENANT scope, including ids that are not real tenants.

Scope

  • Setting definitions gain a tenant_overridable flag. Only flagged keys may be written at tenant scope.
  • GET/PUT/DELETE /api/settings/tenant/current/{key} acts on request.state.tenant_id, never a tenant id from the URL. It is guarded by a new settings.tenant.edit permission mapped onto tenant:owner and tenant:admin through the shared tenant-role vocabulary.
  • Platform routes validate TENANT scope_id against known tenants when tenants is installed.
  • Tests: a tenant admin can edit its own tenant's overridable keys, cannot edit another tenant's keys, cannot edit system scope, and cannot edit non-overridable keys.

Setting keeps its explicit (scope, scope_id, key) key, with no mixin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions