Group

Todo

Docstrings (module)

Models

class indico.modules.groups.models.groups.LocalGroup(**kwargs)

Bases: sqlalchemy.ext.declarative.api.Model

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

id

the unique id of the group

members

the local groups this user belongs to

name

the name of the group

proxy

Returns a GroupProxy wrapping this group

class indico.modules.groups.core.GroupProxy

Bases: object

Provides a generic interface for both local and multipass groups.

Creating an instance of this class actually creates either a LocalGroupProxy or a MultipassGroupProxy, but they expose the same API.

Parameters:
  • name_or_id – The name of a multipass group or ID of a local group
  • provider – The provider of a multipass group

Creates the correct GroupProxy for the group type

as_legacy
as_legacy_group

The legacy-style group wrapper

as_principal

The serializable principal identifier of this group

get_members()

Gets the list of users who are members of the group

classmethod get_named_default_group(name)

Gets the group with the matching name from the default group provider.

If there is no default group provider, local groups will be used and name is the group’s ID.

This method should only be used for legacy code or code that gets the group name from an external source which does not contain a provider identifier.

group

The underlying group object

has_member(user)

Checks if the user is a member of the group.

This can also be accessed using the in operator.

is_group = True
is_network = False
is_single_person = False
principal_order = 2
classmethod search(name, exact=False, providers=None)

Searches for groups

Parameters:
  • name – The group name to search for.
  • exact – If only exact matches should be found (much faster)
  • providersNone to search in all providers and local groups. May be a set specifying providers to search in. For local groups, the 'indico' provider name may be used.

Utilities

indico.modules.groups.util.serialize_group(group)

Serialize group to JSON-like object