pypicloud.access.remote module

Backend that defers to another server for access control

class pypicloud.access.remote.RemoteAccessBackend(request=None, settings=None, server=None, auth=None, **kwargs)[source]

Bases: pypicloud.access.base.IAccessBackend

This backend allows you to defer all user auth and permissions to a remote server. It requires the requests package.

classmethod configure(settings)[source]

Configure the access backend with app settings

group_members(group)[source]

Get a list of users that belong to a group

Parameters:
group : str
Returns:
users : list

List of user names

group_package_permissions(group)[source]

Get a list of all packages that a group has permissions on

Parameters:
group : str
Returns:
packages : list

List of dicts. Each dict contains ‘package’ (str) and ‘permissions’ (list)

group_permissions(package)[source]

Get a mapping of all groups to their permissions on a package

Parameters:
package : str

The name of a python package

Returns:
permissions : dict

mapping of group name to a list of permissions (which can contain ‘read’ and/or ‘write’)

groups(username=None)[source]

Get a list of all groups

If a username is specified, get all groups that the user belongs to

Parameters:
username : str, optional
Returns:
groups : list

List of group names

is_admin(username)[source]

Check if the user is an admin

Parameters:
username : str
Returns:
is_admin : bool
user_data(username=None)[source]

Get a list of all users or data for a single user

For Mutable backends, this MUST exclude all pending users

Returns:
users : list

Each user is a dict with a ‘username’ str, and ‘admin’ bool

user : dict

If a username is passed in, instead return one user with the fields above plus a ‘groups’ list.

user_package_permissions(username)[source]

Get a list of all packages that a user has permissions on

Parameters:
username : str
Returns:
packages : list

List of dicts. Each dict contains ‘package’ (str) and ‘permissions’ (list)

user_permissions(package)[source]

Get a mapping of all users to their permissions for a package

Parameters:
package : str

The name of a python package

Returns:
permissions : dict

Mapping of username to a list of permissions (which can contain ‘read’ and/or ‘write’)

verify_user(username, password)[source]

Check the login credentials of a user

For Mutable backends, pending users should fail to verify

Parameters:
username : str
password : str
Returns:
valid : bool

True if user credentials are valid, false otherwise