dashboard.blueprints.users package¶
Module contents¶
- dashboard.blueprints.users.register_bp(app)¶
Submodules¶
dashboard.blueprints.users.forms module¶
- class dashboard.blueprints.users.forms.AccessRequestForm(*args, **kwargs)¶
Bases:
UserForm
- request_access = <UnboundField(SelectMultipleField, ('Request access to studies: ',), {})>¶
- send_request = <UnboundField(SubmitField, (), {'label': 'Submit Request'})>¶
- studies = <UnboundField(FieldList, (<UnboundField(FormField, (<class 'dashboard.blueprints.users.forms.StudyPermissionsForm'>,), {})>,), {})>¶
- class dashboard.blueprints.users.forms.PermissionRadioField(*args, **kwargs)¶
Bases:
RadioField
- populate_obj(obj, name)¶
This overrides the default function from wtforms.core.Field to ensure the database models receive boolean values and not strings of booleans
- class dashboard.blueprints.users.forms.StudyPermissionsForm(*args, **kwargs)¶
Bases:
FlaskForm
- does_qc = <UnboundField(PermissionRadioField, ('Does QC',), {})>¶
- is_admin = <UnboundField(PermissionRadioField, ('Study Admin',), {})>¶
- kimel_contact = <UnboundField(PermissionRadioField, ('Kimel Contact',), {})>¶
- primary_contact = <UnboundField(PermissionRadioField, ('Primary Contact',), {})>¶
- revoke_access = <UnboundField(SubmitField, ('Remove',), {})>¶
- site_id = <UnboundField(HiddenField, (), {})>¶
- study_RA = <UnboundField(PermissionRadioField, ('Study RA',), {})>¶
- study_id = <UnboundField(HiddenField, (), {})>¶
- user_id = <UnboundField(HiddenField, (), {})>¶
- class dashboard.blueprints.users.forms.UserAdminForm(*args, **kwargs)¶
Bases:
UserForm
- add_access = <UnboundField(SelectMultipleField, ('Enable user access: ',), {})>¶
- dashboard_admin = <UnboundField(BooleanField, ('Dashboard Admin: ',), {})>¶
- is_active = <UnboundField(BooleanField, ('Active Account: ',), {})>¶
- populate_obj(obj)¶
As with process, this implementation is the same as WTForm 2.1’s default with the ‘studies’ field treated as a special case to account for the fact that it is a mapped collection
- process(formdata=None, obj=None, data=None, **kwargs)¶
This is identical to WTForm 2.1’s implementation of ‘process’, but it must pass in the User.studies.values() when it’s called with an object instead of just User.studies, since studies is a mapped collection
- revoke_all_access = <UnboundField(SubmitField, (), {'label': 'Remove All'})>¶
- studies = <UnboundField(FieldList, (<UnboundField(FormField, (<class 'dashboard.blueprints.users.forms.StudyPermissionsForm'>,), {})>,), {})>¶
- update_access = <UnboundField(SubmitField, (), {'label': 'Enable'})>¶
- class dashboard.blueprints.users.forms.UserForm(*args, **kwargs)¶
Bases:
FlaskForm
- account = <UnboundField(StringField, ('Username: ',), {'validators': [<wtforms.validators.DataRequired object>], 'render_kw': {'required': True, 'maxlength': '64', 'placeholder': "Username used on account provider's site"}})>¶
- alt_ext = <UnboundField(StringField, ('Alt. Extension: ',), {'render_kw': {'maxlength': '10', 'placeholder': 'XXXXXXXXXX'}})>¶
- alt_phone = <UnboundField(TelField, ('Alt. Phone Number: ',), {'render_kw': {'maxlength': '20', 'placeholder': '555-555-5555'}})>¶
- email = <UnboundField(EmailField, ('Email: ',), {'validators': [<wtforms.validators.DataRequired object>], 'render_kw': {'required': True, 'maxlength': '256', 'placeholder': 'Enter email'}})>¶
- ext = <UnboundField(StringField, ('Extension: ',), {'render_kw': {'maxlength': '10', 'placeholder': 'XXXXXXXXXX'}})>¶
- first_name = <UnboundField(StringField, ('First Name: ',), {'validators': [<wtforms.validators.DataRequired object>], 'render_kw': {'required': True, 'maxlength': '64', 'placeholder': 'Jane'}})>¶
- id = <UnboundField(HiddenField, (), {})>¶
- institution = <UnboundField(StringField, ('Institution: ',), {'render_kw': {'maxlength': '128', 'placeholder': 'Full name or acronym for institution'}})>¶
- last_name = <UnboundField(StringField, ('Last Name: ',), {'validators': [<wtforms.validators.DataRequired object>], 'render_kw': {'required': True, 'maxlength': '64', 'placeholder': 'Doe'}})>¶
- phone = <UnboundField(TelField, ('Phone Number: ',), {'render_kw': {'maxlength': '20', 'placeholder': '555-555-5555'}})>¶
- position = <UnboundField(StringField, ('Position: ',), {'render_kw': {'maxlength': '64', 'placeholder': 'Job title or position'}})>¶
- provider = <UnboundField(RadioField, ('Account provider: ',), {'validators': [<wtforms.validators.DataRequired object>], 'choices': [('github', 'GitHub')], 'default': 'github'})>¶
- submit = <UnboundField(SubmitField, ('Save Changes',), {})>¶
dashboard.blueprints.users.utils module¶
- dashboard.blueprints.users.utils.get_admin_user_form(user)¶
- dashboard.blueprints.users.utils.get_user_form(user, current_user)¶
- dashboard.blueprints.users.utils.parse_enabled_sites(new_access)¶
Parses the UserAdminForm add_access field into a dictionary
- Parameters:
new_access (
list
) – A list of ‘STUDY-SITE’ and ‘STUDY’ stringsUserAdminForm.add_access.data (like the sort returned by) –
- Returns:
A dictionary mapping each study to a list of sites to enable. The empty list indicates ‘all sites’.
- Return type:
dict
- dashboard.blueprints.users.utils.populate_disabled_sites(user)¶
dashboard.blueprints.users.views module¶
- dashboard.blueprints.users.views.before_request()¶
- dashboard.blueprints.users.views.load_user(uid)¶
- dashboard.blueprints.users.views.login()¶
- dashboard.blueprints.users.views.logout()¶
- dashboard.blueprints.users.views.manage_users(user_id=None, approve=False)¶
- dashboard.blueprints.users.views.new_account()¶
- dashboard.blueprints.users.views.refresh_login()¶
- dashboard.blueprints.users.views.user(user_id=None)¶