Fossology Groups¶
Methods used to access “groups/” endpoints.
- class fossology.groups.Groups¶
Class dedicated to all “groups” related endpoints
- add_group_member(group_id: int, user_id: int, perm: MemberPerm = MemberPerm.USER)¶
Add a user to a group
API Endpoint: POST /groups/{group_id}/user/{user_id}
- Parameters:
group_id (int) – the id of the group
user_id (int) – the id of the user
perm (MemberPerm) – the permission level for the user
- Raises:
FossologyApiError – if the REST call failed
- create_group(name: str)¶
Create a group
API Endpoint: POST /groups
- Parameters:
name (str) – the name of the group
- Raises:
FossologyApiError – if the REST call failed
- delete_group(group_id: int)¶
Create a group
API Endpoint: DELETE /groups/{group_id}
- Parameters:
group_id (int) – the id of the group
- Raises:
FossologyApiError – if the REST call failed
- delete_group_member(group_id: int, user_id: int)¶
Delete a user from a group
API Endpoint: DELETE /groups/{group_id}/user/{user_id}
- Parameters:
group_id (int) – the id of the group
user_id (int) – the id of the user
- Raises:
FossologyApiError – if the REST call failed
- list_group_members(group_id: int) list[UserGroupMember] ¶
Get the list of members for a given group (accessible groups for user, all groups for admin)
API Endpoint: GET /groups/{id}/members
- Returns:
a list of members
- Return type:
list()
- Raises:
FossologyApiError – if the REST call failed
- list_groups(deletable: bool = False) list[Group] ¶
Get the list of groups (accessible groups for user, all groups for admin)
If parameter deletable is True, the method will return only deletable groups.
API Endpoint: GET /groups
- Parameters:
deletable (bool (default: False)) – wether to limit the scope only to deletable groups
- Returns:
a list of groups
- Return type:
list()
- Raises:
FossologyApiError – if the REST call failed