Skip to content
This repository was archived by the owner on Sep 24, 2018. It is now read-only.
This repository was archived by the owner on Sep 24, 2018. It is now read-only.

User should have a role, or roles - not both #1280

Description

@joehoyle

Currently on the response of a user, we return array of roles they have. However, on update / create, the client passed the role argument. We should either decide that users only have on role as far as the API concerned, or they have multiple, and you can specify roles when updating the resource.

Activity

  1. added this to the 2.0 Beta 2 milestone on May 21, 2015
  2. rmccue commented on May 21, 2015

    @rmccue
    Member

    This is a good point. I think the key problem is that WP treats it like you only have one role a lot of the time, but obviously supports multiple. The 80% use case is going to be a single role because of this, but we need to support multiple. For the flexibility, we might not be able to optimise for single. 😞

  3. rachelbaker commented on Jun 15, 2015

    @rachelbaker
    Member

    Punted to Beta 4

  4. dd32 commented on Jul 22, 2015

    @dd32

    Exposing roles on read seems correct, because a user can certainly have multiple roles.

    However, when it comes to setting it, I feel there it may be a case where you want role=custom_role mode=append and also role=administrator mode=replace To extend the multiple-role idea though once it's wide-spread, you might want to do roles=[ administrator, custom_role ] mode=replace or roles=[ custom_role, custom_role2 ] mode=append.

    It's worth noting, that WordPress also support per-user capabilities (outside of roles - and I believe as both a "give this user this cap" and "this user cannot perform this cap") which is even more rarely used. It could be worth saying that if you want to use the advanced capabilities/roles of the capabilities system, you should rely upon a plugin which exposes those details.

  5. modified the milestones: 2.0, 2.0 Beta 4 on Aug 7, 2015
  6. joehoyle commented on Jan 30, 2016

    @joehoyle
    MemberAuthor

    We're going to support multiple roles by just changing the key to roles which is an array. This makes it more consistent and works for all use cases, rather than trying to support the "single role" use case.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      Sponsor
      SponsoredKunjungi sekarang
      Promo