Skip to content

Normalize permission model #6189

@nscuro

Description

@nscuro

Current Behavior

Currently, the PERMISSION table is very simplistic:

erDiagram
    PERMISSION {
        BIGINT ID PK
        TEXT NAME
        TEXT DESCRIPTION
    }
Loading

Available permissions are defined in the Permissions class.

Proposed Behavior

Normalize the permission model, such that subject and verb are separated:

erDiagram
    PERMISSION {
        BIGINT ID PK
        TEXT SUBJECT
        TEXT VERB
    }
Loading

The following legacy permissions:

  • PORTFOLIO_MANAGEMENT
  • PORTFOLIO_MANAGEMENT_CREATE
  • PORTFOLIO_MANAGEMENT_READ
  • PORTFOLIO_MANAGEMENT_UPDATE
  • PORTFOLIO_MANAGEMENT_DELETE

Would translate to:

SUBJECT VERB
PORTFOLIO ALL
PORTFOLIO CREATE
PORTFOLIO READ
PORTFOLIO UPDATE
PORTFOLIO DELETE

We could further assign ranks to each verb, such that UPDATE implies READ, and ALL implies all verbs. This could be achieved by defining verbs in an enum, or a separate VERB table.

With the above in place, queries could use efficient "has at least verb X on subject Y" predicates. This roughly resembles GitLab's model of "access levels" (see DependencyTrack/hyades#1632 (comment)).

Checklist

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions