GitHub-only
WARNING: If you are reading this on GitHub, DON'T! Read the documentation at docs.plone.org so you have working references and proper formatting.
plone.api.group¶
Module that provides functionality for group manipulation.
-
plone.api.group.add_user(groupname=None, group=None, username=None, user=None)¶ -
Add the user to a group.
Arguments
groupnameandgroupare mutually exclusive. You can either set one or the other, but not both.Arguments
usernameanduserare mutually exclusive. You can either set one or the other, but not both.Parameters: - groupname (string) -- Name of the group to which to add the user.
- group (GroupData object) -- Group to which to add the user.
- username (string) -- Username of the user to add to the group.
- user (MemberData object) -- User to add to the group.
Raises: ValueError UserNotFoundError
Example:
-
plone.api.group.create(groupname=None, title=None, description=None, roles=[], groups=[])¶ -
Create a group.
Parameters: - groupname (string) -- [required] Name of the new group.
- title (string) -- Title of the new group
- description (string) -- Description of the new group
- roles (list) -- Roles to assign to this group
- groups (list) -- Groups that belong to this group
Returns: Newly created group
Return type: GroupData object
Raises: ValueError
Example:
-
plone.api.group.delete(groupname=None, group=None)¶ -
Delete a group.
Arguments
groupnameandgroupare mutually exclusive. You can either set one or the other, but not both.Parameters: - groupname (string) -- Name of the group to be deleted.
- group (GroupData object) -- Group object to be deleted.
Raises: ValueError
Example:
-
plone.api.group.get(groupname=None)¶ -
Get a group.
Parameters: groupname (string) -- [required] Name of the group we want to get. Returns: Group Return type: GroupData object Raises: ValueError Example: Get group
-
plone.api.group.get_groups(username=None, user=None)¶ -
Get all groups or all groups filtered by user.
Arguments
usernameanduserare mutually exclusive. You can either set one or the other, but not both.Parameters: - username (string) -- Username of the user for which to return groups. If set, only return groups that this user is member of.
- user (MemberData object) -- User for which to return groups. If set, only return groups that this user is member of.
Returns: All groups (optionlly filtered by user)
Return type: List of GroupData objects
Raises: UserNotFoundError
Example:
-
plone.api.group.get_roles(groupname=None, group=None, obj=None)¶ -
Get group's site-wide or local roles.
Arguments
groupnameandgroupare mutually exclusive. You can either set one or the other, but not both.Parameters: - groupname (string) -- Name of the group to get roles from.
- group (GroupData object) -- Group to get roles from.
- obj (content object) -- If obj is set then return local roles on this context.
Raises: ValueError
Example:
-
plone.api.group.grant_roles(groupname=None, group=None, roles=None, obj=None)¶ -
Grant roles to a group.
Arguments
groupnameandgroupare mutually exclusive. You can either set one or the other, but not both.Parameters: - groupname (string) -- Name of the group to grant roles to.
- group (GroupData object) -- Group to grant roles to.
- roles (list of strings) -- List of roles to grant
- obj (content object) -- If obj is set then grant local roles on this context.
Raises: ValueError
Example:
-
plone.api.group.remove_user(groupname=None, group=None, username=None, user=None)¶ -
Remove the user from a group.
Arguments
groupnameandgroupare mutually exclusive. You can either set one or the other, but not both.Arguments
usernameanduserare mutually exclusive. You can either set one or the other, but not both.Parameters: - groupname (string) -- Name of the group to remove the user from.
- group (GroupData object) -- Group to remove the user from.
- username (string) -- Username of the user to delete from the group.
- user (MemberData object) -- User to delete from the group.
Raises: ValueError UserNotFoundError
Example:
-
plone.api.group.revoke_roles(groupname=None, group=None, roles=None, obj=None)¶ -
Revoke roles from a group.
Arguments
groupnameandgroupare mutually exclusive. You can either set one or the other, but not both.Parameters: - groupname (string) -- Name of the group to revoke roles to.
- group (GroupData object) -- Group to revoke roles to.
- roles (list of strings) -- List of roles to revoke
- obj (content object) -- If obj is set then revoke local roles on this context.
Raises: ValueError
Example: