""" 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'])
""" 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)
""" 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 )
""" 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 )
""" 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)
'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)
""" 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)
""" 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'])
""" 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)
""" 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'])
""" 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)
""" 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)
""" 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)
""" 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)
""" 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 )
""" 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)
""" Enable multi-factor authentication (MFA) for the user. """ from flask import g from manhattan.nav import Nav from manhattan.users import views from blueprints.users.manage.config import UserConfig # Chains enable_chains = views.mfa.enable_chains.copy() # Set the URL UserConfig.add_view_rule('/security/mfa/enable', 'mfa_enable', enable_chains) # Set nav rules Nav.apply(UserConfig.get_endpoint('mfa_enable'), ['not_mfa_enabled']) @Nav.rule def not_mfa_enabled(**view_args): return not g.user.mfa_enabled
""" 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'])
""" 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'])
""" 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'])
""" 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, )
""" 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)
""" 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)