Frontpage

class plinth.frontpage.Shortcut(component_id, name, short_description=None, icon=None, url=None, description=None, configure_url=None, clients=None, login_required=False, allowed_groups=None)[source]

An application component for handling shortcuts.

__init__(component_id, name, short_description=None, icon=None, url=None, description=None, configure_url=None, clients=None, login_required=False, allowed_groups=None)[source]

Initialize the frontpage shortcut component for an app.

When a user visits this web interface, they are first shown the frontpage. It’s primary contents are the list of shortcuts to services that user may use on the server. If a service requires logging in, it does not show up to anonymous users. If a service requires a user to be part of a group, that service is only shown to those users.

‘component_id’ must be a unique string across all apps and components of a app. Conventionally starts with ‘shortcut-‘.

‘name’ is the mandatory title for the shortcut.

‘short_description’ is an optional secondary title for the shortcut.

‘icon’ is used to find a suitable image to represent the shortcut.

‘url’ is link to which the user is redirected when the shortcut is activated. This is typically the web interface for a particular service provided by the app. For shortcuts that should simply additional information this value must be None.

‘details’ are additional information that the user is shown when the shortcut is activated. This must be provided instead of ‘url’ and must be ‘None’ if ‘url’ is provided.

‘configure_url’ is the page to which the user may be redirected if they wish to change the settings for the app or one of its services. This is only used when ‘url’ is ‘None’. It is optionally provided along with ‘details’.

‘clients’ is a list of clients software that can used to access the service offered by the shortcut. This should be a valid client information structure as validated by clients.py:validate().

If ‘login_required’ is true, only logged-in users will be shown this shortcut. Anonymous users visiting the frontpage won’t be shown this shortcut.

‘allowed_groups’ specifies a list of user groups to whom this shortcut must be shown. All other user groups will not be shown this shortcut on the frontpage. If ‘login_required’ is False, this property has not effect and the shortcut is shown to all the users including anonymous users.

classmethod list(username=None, web_apps_only=False, sort_by='name')[source]

Return menu items in sorted order according to current locale.

remove()[source]

Remove this shortcut from global list of shortcuts.