Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot roll user out and make them a free account #490

Open
4 tasks done
g1t-out opened this issue Feb 21, 2025 · 3 comments
Open
4 tasks done

Cannot roll user out and make them a free account #490

g1t-out opened this issue Feb 21, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@g1t-out
Copy link

g1t-out commented Feb 21, 2025

Description of the Issue

I'm unable to roll users out of my enterprise using Box's Python SDK. The call to update_user_by_id indicates it was successful, but the user remains in the enterprise.

Steps to Reproduce

self.box_client.users.update_user_by_id(user.id, enterprise=None)

If I run a report on activity in the enterprise, I see indications that this app updated the user, but nothing changed. This is the exact same things I saw when I reported this bug in the .Net SDK ( see this ).

The documentation says "Set this to null to roll the user out of the enterprise and make them a free user".

I think the issue here is that because null is the default for this attribute, you can't determine a value was actually passed. Because it is null, the enterprise attribute is removed from the final request and never sent to the Box API.

Expected Behavior

The account is out of the enterprise and now a free account.

Versions Used

Python SDK: box-sdk-gen 1.12.0
Python: 3.11.4

@g1t-out
Copy link
Author

g1t-out commented Feb 21, 2025

I also tried this:

from box_sdk_gen import NullValue

self.box_client.users.update_user_by_id(user.id, enterprise=NullValue())

And I get a 400 from Box. Oddly though, it looks like the request was correct, so I'm at a bit of a loss as to why it didn't work. I can see the request was sent to https://api.box.com/2.0/users/1234567890 with a body of {"enterprise": null}, but I get this from Box:

{
    "type": "error",
    "status": 400,
    "code": "bad_request",
    "context_info": {
        "errors": [
            {
                "reason": "invalid_parameter",
                "name": "user",
                "message":"Invalid value 'Box_User 1234567890'."
            }
        ]
    },
    "help_url": "http://developers.box.com/docs/#errors",
    "message": "Bad Request",
    "request_id": "nolqsvhysvbfwofz"
}

@g1t-out
Copy link
Author

g1t-out commented Feb 21, 2025

After a support ticket, I found the above error was because the user I was testing with also had a legal hold on them. After removing it, using the NullValue() does seem to work correctly. Perhaps using NullValue() instead of None needs to be documented?

@congminh1254
Copy link
Member

Hi @g1t-out

Thanks for your feedback, I will discuss this topic with team soon and document should be update in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants