Skip to content

user.enable doesn't work after a user was disabled in the project #1519

Description

@sirkozuch

I'm currently trying to use Ruby SDK to create an application for user management. Came across the cookbook, specifically the manual how to enable and disable users in the project.

After deactivating a user, I can see the user in the deactivated section of the users in the project. Afterwards, I'd like to re-enable the user, but I receive the following message:

undefined method `enable' for nil:NilClass (NoMethodError)
        from /Library/Ruby/Gems/2.3.0/gems/gooddata-2.1.3/lib/gooddata/core/project.rb:63:in `with_project'
        from test.rb:14:in `block in <main>'
        from /Library/Ruby/Gems/2.3.0/gems/gooddata-2.1.3/lib/gooddata/connection.rb:47:in `with_connection'
        from test.rb:13:in `<main>'

I guess, the issue is, that when I type in project.member?('john@doe.com') I receive false, as if the user was not in the project, although I see him in the deactivated section.

I really need to deactivate the user and then re-activate him, but it does not seem possible at the moment.

Is this an expected behavior? Are there any workaround?

Code:

# deactivate

GoodData.with_connection('koz@gmail.com', 'abcd1234') do |client|
  GoodData.with_project('xxxxxxx') do |project|

    pp project.member?('koz+test@gmail.com') # returns True
    user = project.member(koz+test@gmail.com')
    user.disable
  end
end
# activate back

GoodData.with_connection('koz@gmail.com', 'abcd1234') do |client|
  GoodData.with_project('xxxxxxx') do |project|

    pp project.member?('koz+test@gmail.com') # returns False
    user = project.member(koz+test@gmail.com') # doesn't initiate
    user.enable
  end
end

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