dapla_metadata.dapla package

dapla_metadata.dapla.user_info module

class DaplaLabUserInfo[source]

Bases: object

Information about the current user when running on Dapla Lab.

property current_group: str

Get the group which the user is currently representing.

property current_team: str

Get the team which the user is currently representing.

property short_email: str | None

Get the short email address.

class TestUserInfo[source]

Bases: object

Information about the current user for local development and testing.

PLACEHOLDER_EMAIL_ADDRESS = 'default_user@ssb.no'
PLACEHOLDER_GROUP = 'default-team-developers'
PLACEHOLDER_TEAM = 'default-team'
property current_group: str | None

Get the group which the user is currently representing.

property current_team: str | None

Get the team which the user is currently representing.

property short_email: str | None

Get the short email address.

class UnknownUserInfo[source]

Bases: object

Fallback when no implementation is found.

property current_group: str

Get the group which the user is currently representing.

property current_team: str

Get the team which the user is currently representing.

property short_email: str | None

Unknown email address.

class UserInfo(*args, **kwargs)[source]

Bases: Protocol

Information about the current user.

Implementations may be provided for different platforms or testing.

property current_group: str

Get the group which the user is currently representing.

property current_team: str

Get the team which the user is currently representing.

property short_email: str | None

Get the short email address.

get_user_info_for_current_platform()[source]

Return the correct implementation of UserInfo for the current platform.

Return type:

UserInfo

parse_team_name(group)[source]

Parses the group to get the current team.

Return type:

str

Parameters:

group (str)

>>> parse_team_name("dapla-metadata-developers")
'dapla-metadata'
>>> parse_team_name("dapla-metadata-data-admins")
'dapla-metadata'
>>> parse_team_name("dapla-metadata")
'dapla'
>>> parse_team_name("dapla-metadata-not-real-name")
'dapla-metadata-not-real'