Beispiel #1
0
"""
Update a user.
"""

from manhattan.nav import Nav
from manhattan.users import views

from blueprints.users.manage.config import UserConfig

# Chains
update_chains = views.update_chains.copy()

# Set the URL
UserConfig.add_view_rule('/users/update', 'update', update_chains)

# Set the nav rules
Nav.apply(UserConfig.get_endpoint('update'), ['not_me'])
Beispiel #2
0
"""
Allow users to sign-in.
"""

from manhattan.users import views

from blueprints.users.manage.config import UserConfig

# Chains
sign_in_chains = views.sign_in_chains.copy()

# Set the URL
UserConfig.add_view_rule('/sign-in', 'sign_in', sign_in_chains)
Beispiel #3
0
"""
Display the activity log for a user.
"""

from manhattan.users import views

from blueprints.users.manage.config import UserConfig


# Chains
activity_log_chains = views.activity_log_chains.copy()

# Set the URL
UserConfig.add_view_rule(
    '/users/activity-log',
    'activity_log',
    activity_log_chains
)
Beispiel #4
0
"""
Resend an invite to a user.
"""

from manhattan.users import views

from blueprints.users.manage.config import UserConfig


# Chains
resend_invite_chains = views.resend_invite_chains.copy()

# Set the URL
UserConfig.add_view_rule(
    '/users/resend-invite',
    'resend_invite',
    resend_invite_chains
)
Beispiel #5
0
"""
Allow a user to change their password, view, enable and disable their
multi-factor authentication and
"""

from manhattan.users import views

from blueprints.users.manage.config import UserConfig

# Chains
security_chains = views.security_chains.copy()

# Set the URLs
UserConfig.add_view_rule('/security', 'security', security_chains)
Beispiel #6
0
            'length': {
                'datasets': [{
                    'data': [
                        round(v / 1000000, 2)
                        for v in stats.get_series(length_keys)
                    ],
                    **color
                }],
                'labels':
                stats.get_series_labels(length_keys)
            },
            'variations': {
                'datasets': [{
                    'data': stats.get_series(variations_keys),
                    **color
                }],
                'labels': stats.get_series_labels(variations_keys)
            }
        }


@dashboard_chains.link
def get_workers_and_tasks(state):
    state.tasks = len(
        get_tasks(current_app.redis, AnalyzeTask, GenerateVariationTask))
    state.workers = len(get_workers(current_app.redis, AssetWorker))


# Set URL
UserConfig.add_view_rule('/', 'dashboard', dashboard_chains)
Beispiel #7
0
"""
Allow a user to update their profile.
"""

from manhattan.users import views

from blueprints.users.manage.config import UserConfig

# Chains
update_my_profile_chains = views.update_my_profile_chains.copy()

# Set the URL
UserConfig.add_view_rule('/update-my-profile', 'update_my_profile',
                         update_my_profile_chains)
Beispiel #8
0
"""
Delete a user.
"""

from manhattan.nav import Nav
from manhattan.users import views

from blueprints.users.manage.config import UserConfig

# Chains
delete_chains = views.delete_chains.copy()

# Set the URL
UserConfig.add_view_rule('/users/delete', 'delete', delete_chains)

# Set the nav rules
Nav.apply(UserConfig.get_endpoint('delete'), ['not_me'])
Beispiel #9
0
"""
Sign the current user out.
"""

from manhattan.users import views

from blueprints.users.manage.config import UserConfig


# Chains
sign_out_chains = views.sign_out_chains.copy()

# Set the URL
UserConfig.add_view_rule('/sign-out', 'sign_out', sign_out_chains)
Beispiel #10
0
"""
Authorize the user using a secondary mechanism.
"""

from manhattan.nav import Nav
from manhattan.users import views

from blueprints.users.manage.config import UserConfig

# Chains
auth_chains = views.mfa.auth_chains.copy()

# Set the URL
UserConfig.add_view_rule('/security/mfa/auth', 'mfa_auth', auth_chains)

# Set nav rules
Nav.apply(UserConfig.get_endpoint('mfa_auth'), ['mfa_enabled'])
Beispiel #11
0
"""
Add a user.
"""

from manhattan.users import views

from blueprints.users.manage.config import UserConfig

# Chains
add_chains = views.add_chains.copy()

# Set the URL
UserConfig.add_view_rule('/users/add', 'add', add_chains)
Beispiel #12
0
"""
Display the change log for a user.
"""

from manhattan.users import views

from blueprints.users.manage.config import UserConfig

# Chains
change_log_chains = views.change_log_chains.copy()

# Set the URL
UserConfig.add_view_rule('/users/change-log', 'change_log', change_log_chains)
Beispiel #13
0
"""
Remove a lock from a user.
"""

from manhattan.users import views

from blueprints.users.manage.config import UserConfig

# Chains
remove_lock_chains = views.remove_lock_chains.copy()

# Set the URL
UserConfig.add_view_rule('/users/remove-lock', 'remove_lock',
                         remove_lock_chains)
Beispiel #14
0
"""
Revoke a user's session.
"""

from manhattan.users import views

from blueprints.users.manage.config import UserConfig

# Chains
revoke_session_chains = views.revoke_session_chains.copy()

# Set the URLs

UserConfig.add_view_rule('/users/revoke-session', 'revoke_session',
                         revoke_session_chains)

UserConfig.add_view_rule('/users/revoke-my-session', 'revoke_my_session',
                         revoke_session_chains)
Beispiel #15
0
"""
Allow users to request a new invite.
"""

from manhattan.users import views

from blueprints.users.manage.config import UserConfig


# Chains
request_new_invite_chains = views.request_new_invite_chains.copy()

# Set the URL
UserConfig.add_view_rule(
    '/request-new-invite',
    'request_new_invite',
    request_new_invite_chains
)
Beispiel #16
0
"""
Allow users to accept an invite to join the application.
"""

from manhattan.users import views

from blueprints.users.manage.config import UserConfig

# Chains
accept_invite_chains = views.accept_invite_chains.copy()

# Set the URL
UserConfig.add_view_rule('/accept-invite', 'accept_invite',
                         accept_invite_chains)
Beispiel #17
0
"""
Download a text file containing the user's recovery codes.
"""

from manhattan.nav import Nav
from manhattan.users import views

from blueprints.users.manage.config import UserConfig

# Chains
download_recovery_codes_chains \
        = views.mfa.download_recovery_codes_chains.copy()

# Set the URL
UserConfig.add_view_rule('/security/mfa/download-recovery-codes',
                         'mfa_download_recovery_codes',
                         download_recovery_codes_chains)

# Set nav rules
Nav.apply(UserConfig.get_endpoint('mfa_download_recovery_codes'),
          ['mfa_enabled'])
Beispiel #18
0
"""
Regenerate the user's list of recovery codes.
"""

from manhattan.nav import Nav
from manhattan.users import views

from blueprints.users.manage.config import UserConfig

# Chains
regenerate_recovery_codes_chains \
        = views.mfa.regenerate_recovery_codes_chains.copy()

# Set URL
UserConfig.add_view_rule('/security/mfa/regenerate-recovery-codes',
                         'mfa_regenerate_recovery_codes',
                         regenerate_recovery_codes_chains)

# Set nav rules
Nav.apply(UserConfig.get_endpoint('mfa_regenerate_recovery_codes'),
          ['mfa_enabled'])
Beispiel #19
0
"""
Primary navigation menu for the manage area.
"""

from manhattan.nav import Nav, NavItem
from mongoframes import Q

from blueprints.accounts.manage.config import AccountConfig
from blueprints.assets.manage.config import AssetConfig
from blueprints.users.manage.config import UserConfig

# Define the primary menu
menu = Nav.menu('manage')

# Dashboard
menu.add(NavItem('Dashboard', UserConfig.get_endpoint('dashboard')))

# Assets

assets_group = Nav.menu('assets_group')
assets_group.label = 'Assets'
assets_group.data = {'group': True}
menu.add(assets_group)

# Assets > Assets
assets_group.add(NavItem('Assets', AssetConfig.get_endpoint('list')))

# Admin

admin_group = Nav.menu('admin_group')
admin_group.label = 'Admin'
Beispiel #20
0
"""
Disable multi-factor authentication (MFA) for the user.
"""

from manhattan.nav import Nav
from manhattan.users import views

from blueprints.users.manage.config import UserConfig

# Chains
disable_chains = views.mfa.disable_chains.copy()

# Set the URL
UserConfig.add_view_rule('/security/mfa/disable', 'mfa_disable',
                         disable_chains)

# Set the nav rules
Nav.apply(UserConfig.get_endpoint('mfa_disable'), ['mfa_enabled'])
Beispiel #21
0
"""
Allow users to request a link to reset their password with.
"""


from manhattan.users import views

from blueprints.users.manage.config import UserConfig


# Chains
reset_password_chains = views.reset_password_chains.copy()

# Set the URL
UserConfig.add_view_rule(
    '/reset-password',
    'reset_password',
    reset_password_chains,
)
Beispiel #22
0
"""
Allow users to set a new password.
"""

from manhattan.users import views

from blueprints.users.manage.config import UserConfig

# Chains
set_new_password_chains = views.set_new_password_chains.copy()

# Set the URL
UserConfig.add_view_rule('/set-new-password', 'set_new_password',
                         set_new_password_chains)
Beispiel #23
0
"""
View a user.
"""

from manhattan.users import views

from blueprints.users.manage.config import UserConfig

# Chains
view_chains = views.view_chains.copy()

# Set the URL
UserConfig.add_view_rule('/users/view', 'view', view_chains)