Rename @\user and @\subject

Proposal

Rename the DSL terminology to use actor and resource instead of @user and @subject:

actor-predicate-[resource]
  • @user → @actor (more generic, less opinionated; aligns with PolicyActor)
  • @subject → @resource (avoids confusion with object which refers to Ruby objects elsewhere in code and docs)

This is not a breaking change. The old names (@user, @subject) can be aliased and deprecated, allowing a smooth migration over time.

See the discussion by @splattael building on the suggestion by @ixti, with agreement from @pshutsin and @gerardo-navarro.

Implementation: !72 (closed) (Draft), !83 (closed) (Draft)


Original proposal (breaking change)

Note: This was the original proposal and would have been a breaking change, requiring updates to code, specs, and docs in both this library and gitlab-org/gitlab.

The DSL language of this tool is a series of statements of the form subject-predicate-[object]. However in our case, we name subject => @user and object => @subject.

This is confusing, messes with linguistic and propositional logic terminology, and just makes explaining things harder.

Perhaps we can consider renaming these values? Having object as an alias for @subject would not be disruptive.

In any case, direct access to instance variables is generally frowned upon, so we may wish to encourage accessing these values through methods as a matter of best practice.

Another consideration is that while the pattern of having a user is likely to remain the most common one, there is nothing about this system that requires the subject of the proposition be a 'User` of any kind.

Edited by Peter Leitzen