onadata.apps.api.management.commands package

Submodules

onadata.apps.api.management.commands.apply_can_add_project_perms module

Command apply_can_add_project_perms - applys can_add_project permission to all users who have can_add_xform permission to a user/organization profile.

This was necessary because we previously (April 2018) did not have can_add_project permission on the UserProfile and OrganizationProfile classes. An attempt on doing this in migrations seems not to be a recommended approach.

class onadata.apps.api.management.commands.apply_can_add_project_perms.Command(stdout=None, stderr=None, no_color=False, force_color=False)

Bases: BaseCommand

Command apply_can_add_preject_perms - applys can_add_project permission to all users who have can_add_xform permission to a user/organization profile.

handle(*args, **options)

The actual logic of the command. Subclasses must implement this method.

help = 'Apply can_add_project permissions'
onadata.apps.api.management.commands.apply_can_add_project_perms.org_can_add_project_permission()

Set ‘can_add_project’ permission to all users who have ‘can_add_xform’ permission in the organization profile.

onadata.apps.api.management.commands.apply_can_add_project_perms.user_can_add_project_permission()

Set ‘can_add_project’ permission to all users who have ‘can_add_xform’ permission in the user profile.

onadata.apps.api.management.commands.assign_team_member_permission module

Assign permission to the member team

class onadata.apps.api.management.commands.assign_team_member_permission.Command(stdout=None, stderr=None, no_color=False, force_color=False)

Bases: BaseCommand

Assign permission to the member team

args = '<organization>'
assign_perm(team, org)

Assign a team org permissions

handle(*args, **options)

The actual logic of the command. Subclasses must implement this method.

help = 'Assign permission to the member team'

onadata.apps.api.management.commands.cleanup_permissions module

Cleanup permissions

class onadata.apps.api.management.commands.cleanup_permissions.Command(stdout=None, stderr=None, no_color=False, force_color=False)

Bases: BaseCommand

Cleanup permissions

handle(*args, **options)

The actual logic of the command. Subclasses must implement this method.

help = 'Cleanup permissions'

onadata.apps.api.management.commands.create_default_project module

Check for forms not in a project and move them to the default project

class onadata.apps.api.management.commands.create_default_project.Command(stdout=None, stderr=None, no_color=False, force_color=False)

Bases: BaseCommand

Check for forms not in a project and move them to the default project

handle(*args, **options)

The actual logic of the command. Subclasses must implement this method.

help = 'Check for forms not in a project and move them to the default project'
set_project_to_user_forms(user)

Set default project for all user forms.

onadata.apps.api.management.commands.create_user_profiles module

Management Command to add missing user profiles to users.

class onadata.apps.api.management.commands.create_user_profiles.Command(stdout=None, stderr=None, no_color=False, force_color=False)

Bases: BaseCommand

Create missing user profiles management command.

handle(*args, **options)

The actual logic of the command. Subclasses must implement this method.

help = 'Build out missing user profiles'

onadata.apps.api.management.commands.delete_users module

Delete users management command.

class onadata.apps.api.management.commands.delete_users.Command(stdout=None, stderr=None, no_color=False, force_color=False)

Bases: BaseCommand

Delete users management command.

Parameters:
  • user_details

  • user_input

Usage: The mandatory arguments are –user_details –user_details username1:email username2:email

The command defaults the values for the –user_input attribute to False To change this, pass this in with the value True i.e –user_input True

add_arguments(parser)

Entry point for subclassed commands to add custom arguments.

handle(*args, **kwargs)

The actual logic of the command. Subclasses must implement this method.

help = 'Delete users'
onadata.apps.api.management.commands.delete_users.get_user_object_stats(username)

Get User information.

onadata.apps.api.management.commands.delete_users.inactivate_users(users, user_input)

Soft deletes the user.

onadata.apps.api.management.commands.fix_readonly_role_perms module

fix_readonly_role_perms - Reassign permission to the model when permissions are changed

class onadata.apps.api.management.commands.fix_readonly_role_perms.Command(stdout=None, stderr=None, no_color=False, force_color=False)

Bases: BaseCommand

fix_readonly_role_perms - Reassign permission to the model when

permissions are changed

args = '<app model [created_perm] >'
handle(*args, **options)

The actual logic of the command. Subclasses must implement this method.

help = 'Reassign permission to the model when permissions are changed'
onadata.apps.api.management.commands.fix_readonly_role_perms.check_role(role_class, user, obj, new_perm=None)

Test if the user has the role for the object provided :param role_class: :param user: :param obj: :param new_perm: :return:

onadata.apps.api.management.commands.fix_readonly_role_perms.reassign_perms(user, model, new_perm)

Gets all the permissions the user has on objects and assigns the new permission to them :param user: :param model: :param new_perm: :return:

onadata.apps.api.management.commands.increase_odk_token_lifetime module

Command to increase the ODK token lifetime for a user.

class onadata.apps.api.management.commands.increase_odk_token_lifetime.Command(stdout=None, stderr=None, no_color=False, force_color=False)

Bases: BaseCommand

increase_odk_token_lifetime command

Increase ODK Token lifetime for a particular user.

add_arguments(parser)

Entry point for subclassed commands to add custom arguments.

handle(*args, **options)

The actual logic of the command. Subclasses must implement this method.

help = 'Increase ODK Token lifetime for a particular user.'
onadata.apps.api.management.commands.increase_odk_token_lifetime.increase_odk_token_lifetime(days: int, username: str)

Increase ODK Token lifetime for a particular user.

onadata.apps.api.management.commands.migrate_group_permissions module

Migrate group permissions

class onadata.apps.api.management.commands.migrate_group_permissions.Command(stdout=None, stderr=None, no_color=False, force_color=False)

Bases: BaseCommand

Migrate group permissions

add_arguments(parser)

Entry point for subclassed commands to add custom arguments.

handle(*args, **options)

The actual logic of the command. Subclasses must implement this method.

help = 'Migrate group permissions'

onadata.apps.api.management.commands.migrate_permissions module

Migrate permissions

class onadata.apps.api.management.commands.migrate_permissions.Command(stdout=None, stderr=None, no_color=False, force_color=False)

Bases: BaseCommand

Migrate permissions

add_arguments(parser)

Entry point for subclassed commands to add custom arguments.

handle(*args, **options)

The actual logic of the command. Subclasses must implement this method.

help = 'Migrate permissions'

onadata.apps.api.management.commands.reassign_permission module

reassign_permission - reassign permission to the model when permissions are changed.

class onadata.apps.api.management.commands.reassign_permission.Command(stdout=None, stderr=None, no_color=False, force_color=False)

Bases: BaseCommand

Reassign permission to the model when permissions are changed

args = '<app model [created_perm] >'
check_role(role_class, user, obj, new_perm=None)

Test if the user has the role for the object provided :param role_class: :param user: :param obj: :param new_perm: :return:

handle(*args, **options)

Reassign permission to the model when permissions are changed

help = 'Reassign permission to the model when permissions are changed'
reassign_perms(user, app, model, new_perm)

Gets all the permissions the user has on objects and assigns the new permission to them :param user: :param app: :param model: :param new_perm: :return:

onadata.apps.api.management.commands.regenerate_auth_tokens module

Regenerate Authentication Tokens

class onadata.apps.api.management.commands.regenerate_auth_tokens.Command(stdout=None, stderr=None, no_color=False, force_color=False)

Bases: BaseCommand

Regenerate Authentication Tokens

add_arguments(parser)

Entry point for subclassed commands to add custom arguments.

handle(*args, **options)

The actual logic of the command. Subclasses must implement this method.

help = 'Regenerate Authentication Tokens'

onadata.apps.api.management.commands.reset_rest_services module

Management Command to Remove old bamboo rest services and ensures date modified is not null

class onadata.apps.api.management.commands.reset_rest_services.Command(stdout=None, stderr=None, no_color=False, force_color=False)

Bases: BaseCommand

handle(*args, **options)

The actual logic of the command. Subclasses must implement this method.

help = 'Removes old bamboo rest services and ensures date modified is not null'

onadata.apps.api.management.commands.retrieve_org_or_project_list module

Retrieve collaborators list from all/a specific project(s) or organization(s)

class onadata.apps.api.management.commands.retrieve_org_or_project_list.Command(stdout=None, stderr=None, no_color=False, force_color=False)

Bases: BaseCommand

Retrieve collaborators list from all/a specific project(s) or organization(s)

add_arguments(parser: CommandParser)

Entry point for subclassed commands to add custom arguments.

handle(*args, **options)

The actual logic of the command. Subclasses must implement this method.

help = 'Retrieve collaborators list from all/a specific project(s) or organization(s)'

onadata.apps.api.management.commands.set_api_permissions module

Set object permissions for all objects.

class onadata.apps.api.management.commands.set_api_permissions.Command(stdout=None, stderr=None, no_color=False, force_color=False)

Bases: BaseCommand

Set object permissions for all objects.

handle(*args, **options)

The actual logic of the command. Subclasses must implement this method.

help = 'Set object permissions for all objects.'

Module contents