示例#1
0
文件: update.py 项目: GetmeUK/h51
"""
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'])
示例#2
0
文件: sign_in.py 项目: GetmeUK/h51
"""
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)
示例#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
)
示例#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
)
示例#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)
示例#6
0
文件: dashboard.py 项目: GetmeUK/h51
            '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)
示例#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)
示例#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'])
示例#9
0
文件: sign_out.py 项目: GetmeUK/h51
"""
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)
示例#10
0
文件: auth.py 项目: GetmeUK/h51
"""
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'])
示例#11
0
文件: add.py 项目: GetmeUK/h51
"""
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)
示例#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)
示例#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)
示例#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)
示例#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
)
示例#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)
示例#17
0
"""
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
示例#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'])
示例#19
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'])
示例#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'])
示例#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,
)
示例#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)
示例#23
0
文件: view.py 项目: GetmeUK/h51
"""
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)