Exemplo n.º 1
0
class UserPermissionAssignForm(forms.Form):
    """
    Assign permissions to a user
    """
    user = forms.UserSelectField(__("User"), validators=[forms.validators.DataRequired()],
        description=__("Lookup a user by their username or email address"),
        lastuser=None, usermodel=User,
        autocomplete_endpoint=lambda: url_for('lastuser_oauth.user_autocomplete'),
        getuser_endpoint=lambda: url_for('lastuser_oauth.user_get_by_userids'))
    perms = forms.SelectMultipleField(__("Permissions"), validators=[forms.validators.DataRequired()])
Exemplo n.º 2
0
class TeamPermissionAssignForm(forms.Form):
    """
    Assign permissions to a team
    """
    team_id = forms.RadioField(__("Team"), validators=[forms.validators.DataRequired()],
        description=__("Select a team to assign permissions to"))
    perms = forms.SelectMultipleField(__("Permissions"), validators=[forms.validators.DataRequired()])

    def validate_team_id(self, field):
        teams = [team for team in self.org.teams if team.userid == field.data]
        if len(teams) != 1:
            raise forms.ValidationError(_("Unknown team"))
        self.team = teams[0]
Exemplo n.º 3
0
class ClientTeamAccessForm(forms.Form):
    """
    Select organizations that the client has access to the teams of
    """
    organizations = forms.SelectMultipleField(__("Organizations"))
Exemplo n.º 4
0
class PermissionEditForm(forms.Form):
    """
    Edit a user or team's permissions
    """
    perms = forms.SelectMultipleField(__("Permissions"), validators=[forms.validators.DataRequired()])