Coadmin permission
Hi,
When admin assign a coadmin, he can choose to give permissions such as manage users, manage groups, view user's content, edit user's account, log in to users' accounts, view settings for your company, edit settings for your company, run new reports and access existing reports (there are checkbox for every permission, admin can select)
I find we have API to create user as coadmin, but do we have API to assign these different permissions??
The strange part is, I use update user API like this to make an existing user as a coadmin
curl https://api.box.com/2.0/users/USER_ID \
-H "Authorization: Bearer ACCESS_TOKEN" \
-d '{"role": "coadmin"}' \
-X PUT
It works, I can see from the Admin console, it became coadmin. but none of the checkbox is selected.
When I call get current user API, "role" doesn't even exist.
If I call create user API to create a new user, and set is as coadmin, like this
curl https://api.box.com/2.0/users \
-H "Authorization: Bearer ACCESS_TOKEN" \
-d '{"login": "***email address removed for privacy***", "name": "Ned","role":"coadmin"} \
-X POST
in the Admin console, this user is coadmin, and I can see the manage users, manage groups checkbox are selected.
but when I can get current user API, "role" still doesn't exist.
{
"type": "user",
"id":***phone number removed for privacy***",
"name": "Ned",
"login": "***email address removed for privacy***",
"created_at": "2017-08-01T14:15:18-07:00",
"modified_at": "2017-08-01T14:15:19-07:00",
"language": "en",
"timezone": "America/Los_Angeles",
"space_amount": ***number removed for privacy***40,
"space_used": 0,
"max_upload_size"***phone number removed for privacy***,
"status": "active",
"job_title": "",
"phone": "",
"address": "",
"avatar_url": "https://hello.app.box.com/api/avatar/large***phone number removed for privacy***"
}
So, how can I see the role (admin, coadmin, user) for user
and is there any API to assign different permissions (such as manage users, manage groups, view user's content, edit user's account, log in to users' accounts, view settings for your company, edit settings for your company, run new reports and access existing reports) for coadmin??
Thank you in advance.
-
Based on the steps you described, you updated the user's role correctly.
To get a user's role from the API, you have to request the role field when getting info about the user. The role field is not included in the standard set of fields. Try this call to get the Co-Admin's role:
curl "https://api.box.com/2.0/users/REPLACE_WITH_USER_ID?fields=role" \ -H "Authorization: Bearer REPLACE_WITH_TOKEN"
-
Hello ,
I thought that the fields exposed would be on the SDKs that box team builds and I found this class: https://github.com/box/box-java-sdk/blob/master/src/main/java/com/box/sdk/BoxUser.java.
It contains the following piece of code:
/** * An array of all possible file fields that can be requested when calling {@link #getInfo(String...)}. */ public static final String[] ALL_FIELDS = {"type", "id", "name", "login", "created_at", "modified_at", "role", "language", "timezone", "space_amount", "space_used", "max_upload_size", "tracking_codes", "can_see_managed_users", "is_sync_enabled", "is_external_collab_restricted", "status", "job_title", "phone", "address", "avatar_url", "is_exempt_from_device_limits", "is_exempt_from_login_verification", "enterprise", "my_tags", "hostname", "is_platform_access_only", "external_app_user_id"};
I guess these are all the fields exposed to the API. So... no way to retrieve or set specifics for a co-admin. That is an important limitation if you want to develop your own admin console. Probably something to be added to the backlog ? 🙂
Thanks!
投稿コメントは受け付けていません。
コメント
5件のコメント