magpie.ui.management.views

Module Contents

Classes

ManagementViews

Base methods for Magpie UI pages.

Attributes

LOGGER

magpie.ui.management.views.LOGGER[source]
class magpie.ui.management.views.ManagementViews(request)[source]

Bases: magpie.ui.utils.BaseViews

Base methods for Magpie UI pages.

get_all_groups(self, first_default_group=None)[source]
get_group_info(self, group_name)[source]
get_group_users(self, group_name)[source]
update_group_info(self, group_name, group_info)[source]
delete_group(self, group_name)[source]
get_user_groups(self, user_name)[source]
get_user_names(self)[source]

Obtains all user names.

get_user_statuses(self: Union[str, int], status=0)List[str][source]

Obtains all user names that have the corresponding status value.

get_user_emails(self)[source]
get_user_details(self: Optional[Union[str, int]], status=None)List[magpie.typedefs.JSON][source]

Obtains all user details, optionally filtered to by corresponding status value.

Employ this method to avoid multiple requests fetching individual information.

get_resource_types(self)[source]
Returns

dictionary of all resources as {id: ‘resource_type’}

Return type

dict

get_services(self, cur_svc_type)[source]
get_service_data(self, service_name)[source]
get_service_types(self)[source]
update_service_name(self, old_service_name, new_service_name, service_push)[source]
update_service_url(self, service_name, new_service_url, service_push)[source]
goto_service(self, resource_id)[source]
static flatten_tree_resource(resource_node, resource_dict)[source]
Parameters
  • resource_node – any-level dictionary composing the resources tree

  • resource_dict – reference of flattened dictionary across levels

Returns

flattened dictionary resource_dict of all {id: ‘resource_type’}

Return type

dict

view_users(self)[source]
add_user(self)[source]
edit_user(self)[source]
view_groups(self)[source]
add_group(self)[source]
resource_tree_parser(self, raw_resources_tree, permission)[source]
perm_tree_parser(self, raw_perm_tree)[source]
static default_get(dictionary, key, default)[source]
edit_group_users(self, group_name)[source]
edit_user_or_group_resource_permissions(self, user_or_group_name, is_user=False)[source]
get_user_or_group_resources_permissions_dict(self, user_or_group_name, services, service_type, is_user=False, is_inherit_groups_permissions=False)[source]

Get the user or group applied permissions as well as applicable permissions for corresponding services.

Result is a tuple of:
  • combined Allowed Permissions (names only) for services and their children resources.

  • dictionary of key-service-name, each with recursive map value of children resource details including the Applied Permissions or Inherited Resources for the corresponding User or Group accordingly to specified arguments.

update_user_or_group_resources_permissions_dict(self, res_perms, updated_perms)[source]
edit_group(self)[source]
static make_sync_error_message(service_names)[source]
sync_services(self: Dict[magpie.typedefs.Str, magpie.typedefs.JSON], services)Tuple[List[magpie.typedefs.Str], Optional[magpie.typedefs.Str]][source]

Syncs specified services.

Returns

names of services that produced a sync error and corresponding sync message (if any).

get_remote_resources_info(self, res_perms, services, session)[source]
static merge_remote_resources(res_perms, services, session)[source]
static get_last_sync_datetimes(service_ids: List[int], session: sqlalchemy.orm.session.Session)List[Optional[datetime.datetime]][source]
delete_resource(self, res_id)[source]
get_ids_to_clean(self, resources)[source]
add_remote_resource(self, service_type, services_names, user_or_group, remote_id, is_user=False)[source]
get_service_resources(self, service_name)[source]
view_services(self)[source]
add_service(self)[source]
edit_service(self)[source]
add_resource(self)[source]