Groups

Interface Group

class portal.vidispine.igroup.GroupHelper(user=None, runas=None, *args, **kwargs)

Perform actions on Groups. Signals are raised before and after every create or update function

addChildToGroup(parent, child)

Adds one group as a child to another

Args: * parent - The name of group to add the child to * childname - The name of the child to add

Returns: * None

containsPortalRole(group, role)

Based on a group name checks if the group contains a particular portal role

Args:
  • group - The group that should be checked if it contains the role

  • role - The role we are looking for

Returns:
  • True if group or parent groups contains portal role, otherwise False

createGroup(group_name, group_document=None)

Creates a group in Vidispine

Args:
  • group_name: Name of the group to be created.

  • group_document: Optional. Describing the group hierarchy and setup. Default is None.

Returns:
  • None.”python.sortImports.args”: [”–force-single-line-imports”],

Signals raised:

  • Pre create: sender=self.__class__, instance=group_name, method=”createGroup”

  • Post create: sender=self.__class__, instance=group_name, method=”createGroup”

doSearch(search_document, page_size=None)

Search for groups using a group search document :param search_document: VSXMLSchema.GroupSearchDocument :param page_size: Return at most specified number of groups. If none it defaults to 10 :return:

getAllGroups(includeRoles=False, sortedList=False, includePortalRoles=False)

Gets a all groups from Vidispine.

Args:
  • includeRoles: Optional parameter for returning roles as well. Default is False

  • sortedList: Sorts the groups and roles if included

  • Optional parameter for returning portal roles as well. These are returned in the same list as Vidispine groups. Default is False

Returns:
  • If includeRoles is False: A list of VSGroups objects

  • If includeRoles is True: {‘vsgroups’: A list of VSGroups objects for groups, ‘vsroles’:A list of VSGroups objects for roles }

getAllIngestGroups(group_list=None, get_only_first_group=False)

Gets all the groups in the system which have ingest right

Args:
  • group_list: If set, all groups within this list with ingest rights will be returned

  • get_only_first_group: Returns only the first group if set to True. Default is False

Returns:
  • A list of VSGroups objects with ingest rights

getAllNotifications()

Returns a list of group notifications

getGroup(group_name)

Gets a group from Vidispine.

Args:
  • group_name: The name of the group to get

Returns:
  • A VSGroup object

getGroupMetadataKey(group_name, key)

Gets a group metadata by key.

Args:
  • group_name: The name of the group

  • key: The metadata key which value is requested

Returns:
  • The value of the key

getGroupsWithIngestRights(group_list, get_only_first_group=False)

Helper function to GroupHelper.getUserIngestGroups From a list of groups, get first groups or all of the groups that has an ingest role by itself or through a parent group

getParentGroupsToGroups(group_name, include_portal_roles=False, include_roles=False, traverse=False)

Return parent groups, roles and portal roles from a group :param group_name: Name of the group to return parents from :param include_portal_roles: Should portal roles be returned as well :param include_roles: Should Vidispine roles be returned as well :param traverse: Return all ancestors :return: List<VSGroup>

getPortalRoleSiblings(role)

Gets the siblings roles for a role

Args:
  • role - VSGroup object of the role we want to return the siblings for

Returns:
  • A list of VSGroups

getPortalRolesBranch(role, main_group=None)

Based on role node calculuates rest of the branch. See getPortalRolesTree for further explanation.

Args:
  • role - Role node to parse

  • main_group - {VSGroup} If we are calculating the tree based on a VS group

Returns:
  • True if group or parent groups contains portal role, otherwise False

getPortalRolesTree(root_roles, main_group=None)

Based on root roles will return the entire roles tree, if you send in main group it will calculate and get the values based on what access that group has within the tree

Here is an example return that is based on a group that have access to rce write and rce read only. {

portal_roles: [
{

access: false, disabled: false, intermediate: false, name: “portal_administrator”, label: “Administrator”, children: [ ]

}, {

access: false, disabled: false, intermediate: true, name: “portal_rce”, label: “Rce”, children: [

{ access: true, disabled: true, intermediate: false, name: “portal_rce_read”, label: “Rce read” children: [ ] }, { access: false, disabled: false, intermediate: false, name: “portal_rce_create”, label: “Rce create”, children: [ ] }, { access: true, disabled: false, intermediate: false, name: “portal_rce_write”, label: “Rce write”, children: [ ] }

]

}

]

}

Args:
  • root_roles - List of root roles

  • main_group - {VSGroup} If we are calculating the tree based on a VS group

Returns:
  • The entire tree structure for roles

getPortalRootRoles()

Get the all the root portal roles of the tree.

Returns:
  • A list of VSGroup objects

getUserGroups(user_name, traverse=True)

Gets the roles and groups for a specific user

Args:
  • user_name: Name of the user which groups should be fetched

  • traverse: Optional. Returns the traversed reults over all parents. Default is True.

Returns:
  • {‘vsgroups’: A list of VSGroups objects for groups, ‘vsroles’:A list of VSGroups objects for roles }

getUserIngestGroups()

Gets a a users ingest groups. This functions iterates over all the groups that the user is in, including the group’s parent(s) and returns the group if the group has direct or inherited ingest rights. It will also return the default ingest group set for the user

Args:
  • None

Returns: (tuple)
  • A list of group names with ingest rights for the user

  • The default ingest group

removeChildGroupFromGroup(group_name, child_group)

Remove a child group from a group

Args:
  • group_name: The name of the parent group.

  • child_group: The name of the child group to be removed.

Returns:
  • None

Signals raised:
  • Pre modify: sender=self.__class__, instance=group_name, method=”removeChildGroupFromGroup”, child_group=child_group

  • Post modify: sender=self.__class__, instance=group_name, method=”removeChildGroupFromGroup”, child_group=child_group

removeGroup(group_name)

Remove a group from Vidispine

Args:
  • group_name: The name of the group to be removed.

Returns:
  • None

Signals raised:
  • Pre delete: sender=self.__class__, instance=group_name, method=”removeGroup”

  • Post delete: sender=self.__class__, instance=group_name, method=”removeGroup”

removeParentGroupFromGroup(parent_group, group_name)

Remove a parent group from a group

Args:
  • parent_group: The name of the parent group to be removed.

  • group_name: The name of the child group.

Returns:
  • None

Signals raised:
  • Pre delete: sender=self.__class__, instance=group_name, method=”removeParentGroupFromGroup”, parent_group=parent_group

  • Post delete: sender=self.__class__, instance=group_name, method=”removeParentGroupFromGroup”, parent_group=parent_group

setChildGroupToGroup(group_name, child_group)

Set a child group to a group

Args:
  • group_name: The name of the group that will be the parent group.

  • child_group: The name of the group that will be the child group

Returns:
  • None

Signals raised:
  • Pre modify: sender=self.__class__, instance=group_name, method=”setChildGroupToGroup”, child_group=child_group

  • Post modify: sender=self.__class__, instance=group_name, method=”setChildGroupToGroup”, child_group=child_group

setDescription(group_name, description)

Set description of a group

Args:
  • group_name: The name of the group.

  • description: The description text

Returns:
  • None

Signals raised:
  • Pre modify: sender=self.__class__, instance=group_name, method=”setDescription”,description=description

  • Post modify: sender=self.__class__, instance=group_name, method=”setDescription”

setGroupMetadataKey(group_name, key, value)

Set a group metadata key

Args:
  • group_name: The name of the group.

  • key: The metadata key which value is requested

  • val: The value to be set to the key

Returns:
  • None

Signals raised:
  • Pre modify: sender=self.__class__, instance=group_name, method=”setDescription”,description=description

  • Post modify: sender=self.__class__, instance=group_name, method=”setDescription”

setParentGroupToGroup(parent_group, group_name)

Set a parent group to a group

Args:
  • parent_group: The name of the group that will be the parent group.

  • group_name: The name of the group that will be the child group

Returns:
  • None

Signals raised:
  • Pre modify: sender=self.__class__, instance=group_name, method=”setParentGroupToGroup”, child_group=child_group

  • Post modify: sender=self.__class__, instance=group_name, method=”setParentGroupToGroup”, child_group=child_group

updateGroup(group_name, group_document, clear=True)

Updates a group in Vidispine

Args:
  • group_name: Name of the group to be updated.

  • group_document: Describing the group hierarchy and setup.

  • clear: If set to True, old associations are cleared, else kept.

Returns:
  • None.

Signals raised:
  • Pre modify: sender=self.__class__, instance=group_name, method=”updateGroup”, query=query, group_document=group_document

  • Post modify: sender=self.__class__, instance=group_name, method=”updateGroup”, query=query, group_document=group_document