Skip to content

users.info does not include roles #20

Open

Description

@andreas-it-dev

Hi,

even though the api docs suggest it should ( https://rocket.chat/docs/developer-guides/rest-api/users/info/ ),calling users.info with an admin user only includes the bare minimums:

@session.users.info(username: @user.username)
=> #<RocketChat::User:0x70137576055220 @id="NJLPbJWM3nRk2M8zY" @username="Andreas" @Active="true">

any hint what i might do wrong?

thanks,
Andreas

Activity

  1. abrom commented on Feb 17, 2018

    @abrom
    Owner

    Hi @awunder,

    There may be a couple of things to consider here. The User model will only display some specific fields if you just dump it out on the console. There may also be some permission issues with your RocketChat user.

    What do you get if you try view the raw data?

    I.e.

    @session.users.info(username: @user.username).data
    
  2. andreas-it-dev commented on Feb 17, 2018

    @andreas-it-dev
    Author

    Hey @abrom ,

    wow, that was quick :)

    i did a further look, forked your gem and played around a bit..

    looks like it wasnt implemented on "your side" so i followed your style and fiddled it in...

    i never made a pull req in my life so i am a bit lost.. however, this is what i've changed:

    andreas-it-dev@10f3f13#diff-c92145718ff59c223c017f5efe02475e

    am probably implementing some other stuff as well while i'm going along the path of integrating rocket chat to my webapp...

    so, maybe i'll figure out the pull req thing on that route as well..

    thanks for your great gem,
    Andreas

  3. abrom commented on Feb 17, 2018

    @abrom
    Owner

    I've left some comments for you. I'd ask that you include a test for your change though

    Creating a PR is pretty easy. Take a look at the Github documentation:
    https://help.github.com/articles/creating-a-pull-request-from-a-fork/

  4. abrom commented on Feb 17, 2018

    @abrom
    Owner

    And in the mean time, you should be able to get what you need with:

    @session.users.info(username: @user.username).data['roles']
    
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions