kojismokydingo.users

Koji Smoki Dingo - users and permissions

author:

Christopher O'Brien <obriencj@gmail.com>

license:

GPL v3

collect_cg_access(session, user)[source]

List of content generators user has access to run CGImport with.

Parameters:
  • session (ClientSession) -- an active koji client session

  • user (int | str | UserInfo) -- Name, ID, or userinfo dict

Raises:

NoSuchUser -- if user is an ID or name which cannot be resolved

Since:

1.0

Return type:

List[NamedCGInfo]

collect_cgs(session, name=None)[source]
Parameters:
  • name (str | None) -- only collect the given CG. Default, collect all

  • session (ClientSession)

Raises:

NoSuchContentGenerator -- if name is specified and no content generator matches

Since:

1.0

Return type:

List[NamedCGInfo]

collect_perminfo(session, permission)[source]

Gather information about a named permission, including the list of users granted the permission, as well as the date that the permission was granted and the user that granted it.

Parameters:
  • session (ClientSession) -- an active koji client session

  • permission (int | str) -- the ID or name of the permission

Raises:

NoSuchPermission -- if there is no matching permission found

Since:

1.0

Return type:

DecoratedPermInfo

collect_userinfo(session, user, stats=False, members=False)[source]

Gather information about a named user, including the list of permissions the user has.

Will convert the older 'krb_principal' value (koji < 1.19) into a 'krb_principals' list (koji >= 1.19) to provide some level of uniformity.

Parameters:
  • session (ClientSession) -- an active koji client session

  • user (int | str | UserInfo) -- name of a user or their kerberos ID

  • stats (bool) -- collect user statistics

  • members (bool) -- look up group members and memberships

Raises:

NoSuchUser -- if user is an ID or name which cannot be resolved

Since:

2.2

Return type:

DecoratedUserInfo

collect_userstats(session, user)[source]

Collects user statistics into a dict

Parameters:
  • session (ClientSession) -- an active koji client session

  • user (int | str | UserInfo) -- name of a user or their kerberos ID

Raises:

NoSuchUser -- if user is an ID or name which cannot be resolved

Since:

2.0

Return type:

UserStatistics

get_group_members(session, user)[source]

An anonymous version of the admin-only getGroupMembers hub API call. Uses queryHistory to gather still-active group additions

Parameters:
  • session (ClientSession) -- an active koji client session

  • user (int | str | UserInfo) -- name or ID of a user group

Returns:

list of users that are members of the given group

Raises:

NoSuchUser -- if no matching user group was found

Since:

2.2

Return type:

List[UserInfo]

get_user_groups(session, user)[source]

Identify groups that a user is a member of

Parameters:
  • session (ClientSession) -- an active koji client session

  • user (int | str | UserInfo) -- name or ID of a potential member

Returns:

list of groups that user is a member of

Raises:

NoSuchUser -- if user could not be found

Since:

2.2

Return type:

List[UserGroup]