keystone.identity.backends.ldap.core 模块

class keystone.identity.backends.ldap.core.GroupApi(conf)[source]

基类: BaseLdap

DEFAULT_ID_ATTR: str = 'cn'
DEFAULT_MEMBER_ATTRIBUTE = 'member'
DEFAULT_OBJECTCLASS: str = 'groupOfNames'
DEFAULT_OU: str = 'ou=UserGroups'
DEFAULT_STRUCTURAL_CLASSES: list[str] = []
NotFound

别名: GroupNotFound

add_user(user_dn, group_id, user_id)[source]
attribute_options_names: dict[str, str] = {'description': 'desc', 'name': 'name'}
create(values)[source]
get_all_filtered(hints, query=None)[source]
get_filtered(group_id)[source]
get_filtered_by_name(group_name)[source]
immutable_attrs: list[str] = ['name']
list_group_users(group_id)[source]

返回组成员的用户 dns 列表。

list_user_groups(user_dn)[source]

返回用户是成员的组列表。

list_user_groups_filtered(user_dn, hints)[source]

返回用户是成员的经过筛选的组列表。

model

别名: Group

options_name: ty.Optional[str] = 'group'
update(group_id, values)[source]
class keystone.identity.backends.ldap.core.Identity(conf=None)[source]

基类: IdentityDriverBase

add_user_to_group(user_id, group_id)[source]

将用户添加到组。

参数:
  • user_id (str) – 用户 ID。

  • group_id (str) – 组 ID。

引发:
authenticate(user_id, password)[source]

验证给定的用户和密码。

参数:
  • user_id (str) – 用户 ID

  • password (str) – 密码

返回值:

用户。请参阅 IdentityDriverBase 中的用户模式。

返回类型:

dict

引发:

AssertionError – 如果用户或密码无效。

change_password(user_id, new_password)[source]

自助密码更改。

参数:
  • user_id (str) – 用户 ID。

  • new_password (str) – 新密码。

引发:
check_user_in_group(user_id, group_id)[source]

检查用户是否是组的成员。

参数:
  • user_id (str) – 用户 ID。

  • group_id (str) – 组 ID。

引发:
create_group(group_id, group)[source]

创建一个新组。

参数:
  • group_id (str) – 组 ID。驱动程序可以忽略此值。

  • group (dict) – 组信息。请参阅 IdentityDriverBase 中的组模式。

返回值:

组,匹配组模式。

返回类型:

dict

引发:

keystone.exception.Conflict – 如果存在重复组。

create_user(user_id, user)[source]

创建一个新用户。

参数:
  • user_id (str) – 用户 ID。驱动程序可以忽略此值。

  • user (dict) – 用户信息。请参阅 IdentityDriverBase 中的用户模式。

返回值:

用户,匹配用户模式。

返回类型:

dict

引发:

keystone.exception.Conflict – 如果存在重复用户。

delete_group(group_id)[source]

删除现有组。

参数:

group_id (str) – 组 ID。

引发:

keystone.exception.GroupNotFound – 如果组不存在。

delete_user(user_id)[source]

删除现有用户。

引发:

keystone.exception.UserNotFound – 如果用户不存在。

generates_uuids()[source]

指示驱动程序是否生成 UUID 作为本地实体 ID。

get_group(group_id)[source]

按 ID 获取组。

参数:

group_id (str) – 组 ID。

返回值:

组信息。请参阅 IdentityDriverBase 中的组模式

返回类型:

dict

引发:

keystone.exception.GroupNotFound – 如果组不存在。

get_group_by_name(group_name, domain_id)[source]

按名称获取组。

参数:
  • group_name (str) – 组名称。

  • domain_id (str) – 域 ID。

返回值:

组信息。请参阅 IdentityDriverBase 中的组模式。

返回类型:

dict

引发:

keystone.exception.GroupNotFound – 如果组不存在。

get_user(user_id)[source]

按 ID 获取用户。

参数:

user_id (str) – 用户 ID。

返回值:

用户。请参阅 IdentityDriverBase 中的用户模式。

返回类型:

dict

引发:

keystone.exception.UserNotFound – 如果用户不存在。

get_user_by_name(user_name, domain_id)[source]

按名称获取用户。

返回值:

user_ref

引发:

keystone.exception.UserNotFound – 如果用户不存在。

is_domain_aware()[source]

指示驱动程序是否支持域。

list_groups(hints)[source]

列出系统中的组。

参数:

hints (keystone.common.driver_hints.Hints) – 驱动程序应尽可能实现的筛选提示。

返回值:

组引用列表或空列表。请参阅 IdentityDriverBase 中的组模式。

list_groups_for_user(user_id, hints)[source]

列出用户所属的组。

参数:
返回值:

组引用列表或空列表。请参阅 IdentityDriverBase 中的组模式。

引发:

keystone.exception.UserNotFound – 如果用户不存在。

list_users(hints)[source]

列出系统中的用户。

参数:

hints (keystone.common.driver_hints.Hints) – 驱动程序应尽可能实现的筛选提示。

返回值:

用户列表或空列表。请参阅 IdentityDriverBase 中的用户模式。

返回类型:

字典列表

list_users_in_group(group_id, hints)[source]

列出组中的用户。

参数:
返回值:

用户列表或空列表。请参阅 IdentityDriverBase 中的用户模式。

返回类型:

字典列表

引发:

keystone.exception.GroupNotFound – 如果组不存在。

remove_user_from_group(user_id, group_id)[source]

从组中删除用户。

参数:
  • user_id (str) – 用户 ID。

  • group_id (str) – 组 ID。

引发:

keystone.exception.NotFound – 如果用户不在该组中。

reset_last_active()[source]

重置 null last_active_at 值。

此方法查找数据库中所有 last_updated_at 值为 null 的用户,并将该值重置为当前时间。

unset_default_project_id(project_id)[source]

给定特定的项目 ID,取消设置用户的默认项目。

参数:

project_id (str) – 项目 ID

update_group(group_id, group)[source]

更新现有组。

参数:
  • group_id (str) – 组 ID。

  • group (dict) – 组修改。请参阅 IdentityDriverBase 中的组模式。不能删除必需的属性。

返回值:

组,匹配组模式。

返回类型:

dict

引发:
update_user(user_id, user)[source]

更新现有用户。

参数:
  • user_id (str) – 用户 ID。

  • user (dict) – 用户修改。请参阅 IdentityDriverBase 中的用户模式。设置为 None 的属性将被删除。不能删除必需的属性。

返回值:

用户。请参阅 IdentityDriverBase 中的用户模式。

引发:
class keystone.identity.backends.ldap.core.UserApi(conf)[source]

基类: EnabledEmuMixIn, BaseLdap

DEFAULT_ID_ATTR: str = 'cn'
DEFAULT_OBJECTCLASS: str = 'inetOrgPerson'
DEFAULT_OU: str = 'ou=Users'
DEFAULT_STRUCTURAL_CLASSES: list[str] = ['person']
NotFound

别名 UserNotFound

attribute_options_names: dict[str, str] = {'default_project_id': 'default_project_id', 'description': 'description', 'email': 'mail', 'enabled': 'enabled', 'name': 'name', 'password': 'pass'}
create(values)[source]
filter_attributes(user)[source]
get(user_id, ldap_filter=None)[source]
get_all(ldap_filter=None, hints=None)[source]
get_all_filtered(hints)[source]
get_filtered(user_id)[source]
immutable_attrs: list[str] = ['id']
is_user(dn)[source]

如果条目是用户,则返回 True。

mask_enabled_attribute(values)[source]
model

别名 User

options_name: ty.Optional[str] = 'user'
update(user_id, values, old_obj=None)[source]