有没有办法将用户添加到 Okta 组?我看到了 update_group,但没有具体说明如何将用户添加到 Okta 组。
问问题
846 次
1 回答
2
add_user_to_group(group, user)
SDK的最新更新add_user_to_group_by_id(gid, uid)
在UserGroupsClient
.
from okta import UserGroupsClient
from okta.models.usergroup import UserGroup
from okta import UsersClient
from okta.models.user import User
groups_client = UserGroupsClient('your_url', 'your_key')
users_client = UsersClient('your_url', 'your_key')
# Create group
group = UserGroup(name='sample_name',
description='sample description')
group = groups_client.create_group(group)
# Create user
user = User(login='sample@asdf.com',
email='fake@asdf.com',
firstName='Joe',
lastName='Schmoe')
user = users_client.create_user(user, activate=False)
groups_client.add_user_to_group(group, user)
# or
groups_client.add_user_to_group_by_id(group.id, user.id)
获取最新信息:
pip install git+git://github.com/okta/oktasdk-python@master
于 2015-06-11T23:15:04.443 回答