Giter Site home page Giter Site logo

Comments (5)

wyattjoh avatar wyattjoh commented on August 20, 2024

Seems that the backend is trying to send back a blank role, hence the message.

from talk.

wyattjoh avatar wyattjoh commented on August 20, 2024

Currently as well, the roles are implemented as an array of roles rather than a single role. The FE needs to implement the ability to remove and add specific roles rather than simply "setting" the role which is what's being done now. The BE doesn't have a method for this yet, but I'd expect to see something like:

...

router.delete('/:user_id/role/:role_name', authorization.needed('admin'), (req, res, next) => {
  User.removeRoleFromUser(req.params.user_id, req.params.role_name)
          .then(() => {
            res.status(204).end();
          })
          .catch((err) => {
            next(err);
          });
});

...

from talk.

jde avatar jde commented on August 20, 2024

Where to put the functionality to set a single role is an interesting question.

My instinct is to create an endpoint that clears a users roles then adds the one that is sent, effectively modeling the single role behavior.

The other option is to handle this on the front end, but asking the front end to send multiple requests to remove and add seems inefficient.

from talk.

wyattjoh avatar wyattjoh commented on August 20, 2024

As multiple roles can have different responsibilities (Even with overlapping responsibilities) I think that the model that we have supports this already.

I spoke with Emma regarding the UX/UI for this and I had suggested changing the role change screen to be similar to the "add a label" component for Github issues, where a dropdown shows all the possible roles, and you click to enable/disable them.

This wouldn't be multiple requests as again, a user could have multiple roles.

from talk.

jde avatar jde commented on August 20, 2024

I like that solution more. Moving this to a pivotal story: https://www.pivotaltracker.com/story/show/135814307

from talk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.