Package x2go :: Package backends :: Package profiles :: Module base :: Class X2GoSessionProfiles

[frames] | no frames]

# Class X2GoSessionProfiles

source code

Known Subclasses:
  - file.X2GoSessionProfiles
  - , gconf.X2GoSessionProfiles
  - , sshbroker.X2GoSessionProfiles
  - , winreg.X2GoSessionProfilesWINREG

Instance Methods

`dict`

__call__(self, profile_id_or_name) Retrieve the session profile configuration for a given session profile ID (or name) | source code

__init__(self, session_profile_defaults=None, logger=None, loglevel=56, **kwargs) Retrieve X2Go session profiles. | source code

`str`

add_profile(self, profile_id=None, force_add=False, **kwargs) Add a new session profile. | source code

`str`

check_profile_id_or_name(self, profile_id_or_name) Detect the profile ID from a given string which maybe profile ID or profile name. | source code

`dict`

default_profile_config(self) Return a default session profile. | source code

delete_profile(self, profile_id_or_name) Delete a session profile from the configuration file. | source code

`obj`

get_pkey_object(self, profile_id) If available, return a PKey (Paramiko/SSH private key) object. | source code

`dict`

get_profile_config(self, profile_id_or_name=None, parameter=None, profile_id=None) The configuration options for a single session profile. | source code

`str`

get_profile_metatype(self, profile_id_or_name, force=False) Detect a human readable session profile type from the session profile configuration. | source code

`type`

get_profile_option_type(self, option) Get the data type for a specific session profile option. | source code

`list`

get_server_hostname(self, profile_id) Retrieve host name of the X2Go Server configured in a session profile. | source code

`list`

get_server_port(self, profile_id) Retrieve SSH port of the X2Go Server configured in a session profile. | source code

depends on the session profile option requested

get_session_param(self, profile_id_or_name, param) Get a single X2GoSession parameter from a specific session profile. | source code

`bool`

has_profile(self, profile_id_or_name) Does a session profile of a given profile ID or profile name exist? | source code

`bool`

has_profile_id(self, profile_id) Does a session profile of a given profile ID exist? (Faster than has_profile().) | source code

`bool`

has_profile_name(self, profile_name) Does a session profile of a given profile name exist? (Faster than has_profile().) | source code

init_profile_cache(self, profile_id_or_name) Some session profile backends (e.g. | source code

`bool`

is_mutable(self, profile_id_or_name=None, profile_id=None) Check if a given profile name (or ID) is mutable or not. | source code

`bool`

mutable_profile_ids(self) List all mutable session profiles. | source code

`dict`

populate_session_profiles(self) Load a session profile set from the configuration storage backend and make it available for this class. | source code

`list`

supports_mutable_profiles(self) Check if the current session profile backend supports mutable session profiles. | source code

`str`

to_profile_id(self, profile_name) Convert profile name to profile ID. | source code

`str`

to_profile_name(self, profile_id) Convert profile ID to profile name. | source code

`dict`

to_session_params(self, profile_id_or_name=None, profile_id=None) Convert session profile options to X2GoSession constructor method parameters. | source code

update_value(self, profile_id_or_name, option, value, profile_id=None) Update a value in a session profile. | source code

`bool`

write(self) Store session profile data to the storage backend. | source code

Class Variables
| defaultSessionProfile = ``{``'``applications``'``:` `[``'``WWWBROWSER``'``,` `'``MAILC``...``

Properties
| profile_ids Render a list of all profile IDs found in the session profiles configuration.
| profile_names Render a list of all profile names found in the session profiles configuration.

Method Details

### __call__(self, profile_id_or_name)
(Call operator)

source code

Retrieve the session profile configuration for a given session profile ID (or name)

Parameters:
  - `profile_id_or_name` (`str`) - profile ID or profile name
Returns: `dict`
  the profile ID's / name's profile configuration

### __init__(self, session_profile_defaults=None, logger=None, loglevel=56, **kwargs)
(Constructor)

source code

Retrieve X2Go session profiles. Base class for the different specific session profile configuration backends.

Parameters:
  - `session_profile_defaults` (`dict`) - a default session profile
  - `logger` (X2GoLogger instance) - you can pass an X2GoLogger object to the x2go.backends.profiles.httpbroker.X2GoSessionProfiles constructor
  - `loglevel` (`int`) - if no X2GoLogger object has been supplied a new one will be constructed with the given loglevel

### add_profile(self, profile_id=None, force_add=False, **kwargs)

source code

Add a new session profile.

Parameters:
  - `profile_id` (`str`) - a custom profile ID--if left empty a profile ID will be auto-generated
  - `kwargs` (`dict`) - session profile options for this new session profile
Returns: `str`
  the (auto-generated) profile ID of the new session profile

### check_profile_id_or_name(self, profile_id_or_name)

source code

Detect the profile ID from a given string which maybe profile ID or profile name.

Parameters:
  - `profile_id_or_name` (`str`) - profile ID or profile name
Returns: `str`
  profile ID
Raises:
  - `X2GoProfileException` - if no such session profile exists

### default_profile_config(self)

source code

Return a default session profile.

Returns: `dict`
  default session profile

### delete_profile(self, profile_id_or_name)

source code

Delete a session profile from the configuration file.

Parameters:
  - `profile_id_or_name` (`str`) - profile ID or profile name

### get_pkey_object(self, profile_id)

source code

If available, return a PKey (Paramiko/SSH private key) object.

Parameters:
  - `profile_id` (`str`) - the profile's unique ID
Returns: `obj`
  a Paramiko/SSH PKey object

### get_profile_config(self, profile_id_or_name=None, parameter=None, profile_id=None)

source code

The configuration options for a single session profile.

Parameters:
  - `profile_id_or_name` (`str`) - either profile ID or profile name is accepted
  - `parameter` (`str`) - if specified, only the value for the given parameter is returned
  - `profile_id` (`str`) - profile ID (faster than specifying `profile_id_or_name`)
Returns: `dict`
  the session profile configuration for the given profile ID (or name)

### get_profile_metatype(self, profile_id_or_name, force=False)

source code

Detect a human readable session profile type from the session profile configuration.

Parameters:
  - `profile_id_or_name` (`str`) - profile ID or profile name
  - `force` (`bool`) - re-detect the meta type, otherwise use a cached result
Returns: `str`
  the profile ID's / name's meta type

### get_profile_option_type(self, option)

source code

Get the data type for a specific session profile option.

Parameters:
  - `option` (will be detected by this method) - the option to get the data type for
Returns: `type`
  the data type of `option`

### get_server_hostname(self, profile_id)

source code

Retrieve host name of the X2Go Server configured in a session profile.

Parameters:
  - `profile_id` (`str`) - the profile's unique ID
Returns: `list`
  the host name of the X2Go Server configured by the session profile of the given profile ID

### get_server_port(self, profile_id)

source code

Retrieve SSH port of the X2Go Server configured in a session profile.

Parameters:
  - `profile_id` (`str`) - the profile's unique ID
Returns: `list`
  the SSH port of the X2Go Server configured by the session profile of the given profile ID

### get_session_param(self, profile_id_or_name, param)

source code

Get a single X2GoSession parameter from a specific session profile.

Parameters:
  - `profile_id_or_name` (`str`) - either profile ID or profile name is accepted
  - `param` (`str`) - the parameter name in the X2GoSession constructor method
Returns: depends on the session profile option requested
  the value of the session profile option represented by `param`

### has_profile(self, profile_id_or_name)

source code

Does a session profile of a given profile ID or profile name exist?

Parameters:
  - `profile_id_or_name` (`str`) - profile ID or profile name
Returns: `bool`
  `True` if there is such a session profile, `False` otherwise

### has_profile_id(self, profile_id)

source code

Does a session profile of a given profile ID exist? (Faster than has_profile().)

Parameters:
  - `profile_id` (`str`) - profile ID
Returns: `bool`
  `True` if there is such a session profile, `False` otherwise

### has_profile_name(self, profile_name)

source code

Does a session profile of a given profile name exist? (Faster than has_profile().)

Parameters:
  - `profile_name` (`str`) - profile name
Returns: `bool`
  `True` if there is such a session profile, `False` otherwise

### init_profile_cache(self, profile_id_or_name)

source code

Some session profile backends (e.g. the broker backends cache dynamic session profile data). On new connections, it is recommented to (re-)initialize these caches.

Parameters:
  - `profile_id_or_name` (`str`) - profile ID or profile name

### is_mutable(self, profile_id_or_name=None, profile_id=None)

source code

Check if a given profile name (or ID) is mutable or not.

Parameters:
  - `profile_id_or_name` (`str`) - profile name or profile ID
  - `profile_id` (`str`) - if the profile ID is known, pass it in directly and skip the check_profile_id_or_name() call
Returns: `bool`
  `True` if the session profile of the specified name/ID is mutable
Raises:
  - `X2GoProfileException` - if no such session profile exists

### mutable_profile_ids(self)

source code

List all mutable session profiles.

Returns: `bool`
  List up all session profile IDs of mutable session profiles.

### populate_session_profiles(self)

source code

Load a session profile set from the configuration storage backend and make it available for this class.

Returns: `dict`
  a set of session profiles

### supports_mutable_profiles(self)

source code

Check if the current session profile backend supports mutable session profiles.

Returns: `list`
  list of mutable profiles

### to_profile_id(self, profile_name)

source code

Convert profile name to profile ID.

Parameters:
  - `profile_name` (`str`) - profile name
Returns: `str`
  profile ID

### to_profile_name(self, profile_id)

source code

Convert profile ID to profile name.

Parameters:
  - `profile_id` (`str`) - profile ID
Returns: `str`
  profile name

### to_session_params(self, profile_id_or_name=None, profile_id=None)

source code

Convert session profile options to X2GoSession constructor method parameters.

Parameters:
  - `profile_id_or_name` (`str`) - either profile ID or profile name is accepted
  - `profile_id` (`str`) - profile ID (fast than specifying `profile_id_or_name`)
Returns: `dict`
  a dictionary of X2GoSession constructor method parameters

### update_value(self, profile_id_or_name, option, value, profile_id=None)

source code

Update a value in a session profile.

Parameters:
  - `profile_id_or_name` (`str`) - the profile ID
  - `option` (`str`) - the session profile option of the given profile ID
  - `value` (any type, depends on the session profile option) - the value to update the session profile option with
  - `profile_id` (`str`) - if the profile ID is known, pass it in directly and skip the check_profile_id_or_name() call

### write(self)

source code

Store session profile data to the storage backend.

Returns: `bool`
  `True` if the write process has been successfull, `False` otherwise

Class Variable Details

### defaultSessionProfile

Value:

      {'applications': ['WWWBROWSER', 'MAILCLIENT', 'OFFICE', 'TERMINAL'],
       'autoconnect': False,
       'autologin': True,
       'autostart': False,
       'clipboard': 'both',
       'command': 'TERMINAL',
       'defsndport': True,
       'directrdp': False,
      ...

Property Details

### profile_ids

Render a list of all profile IDs found in the session profiles configuration.

Get Method:
  unreachable.profile_ids(self) - Render a list of all profile IDs found in the session profiles configuration.

### profile_names

Render a list of all profile names found in the session profiles configuration.

Get Method:
  unreachable.profile_names(self) - Render a list of all profile names found in the session profiles configuration.