You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?('[email protected]') 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('[email protected]', 'abcd1234') do |client|
GoodData.with_project('xxxxxxx') do |project|
pp project.member?('[email protected]') # returns True
user = project.member([email protected]')
user.disable
end
end
# activate back
GoodData.with_connection('[email protected]', 'abcd1234') do |client|
GoodData.with_project('xxxxxxx') do |project|
pp project.member?('[email protected]') # returns False
user = project.member([email protected]') # doesn't initiate
user.enable
end
end
The text was updated successfully, but these errors were encountered:
Hello @SMKozuch, thanks for filing the issue. The #member method only works with enabled users. Here's a possible workaround:
disabled_users=project.users(disabled: true)# or project.users(all: true)project.member('[email protected]',disabled_users)
I will document the disabled and all options when I have the time. We could also make #member accept these options (e.g. project.member([email protected]', all: true)).
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:
I guess, the issue is, that when I type in
project.member?('[email protected]')
I receivefalse
, 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:
The text was updated successfully, but these errors were encountered: