Example #1
0
class BaseUserValidator(validators.Schema):
    allow_extra_fields = True
    filter_extra_fields = True

    UserName = validators.String(max=50, not_empty=True)
    Culture = validators.ActiveCulture(not_empty=True)
    FirstName = validators.String(max=50, not_empty=True)
    LastName = validators.String(max=50, not_empty=True)
    Initials = validators.String(max=6, not_empty=True)
    Organization = validators.String(max=200, not_empty=True)
    Email = validators.Email(not_empty=True)
class ExternalCommunityBaseSchema(validators.Schema):

    AreaName = validators.UnicodeString(max=200, not_empty=True)
    PrimaryAreaType = validators.String(max=30)
    SubAreaType = validators.String(max=30)
    ProvinceState = validators.IntID()
    ExternalID = validators.String(max=50)
    AIRSExportType = validators.String(max=20)

    Parent_ID = validators.IntID()
    Parent_IDName = validators.UnicodeString()

    CM_ID = validators.IntID()
    CM_IDName = validators.UnicodeString()
Example #3
0
class LoginSchema(Schema):
    allow_extra_fields = True
    filter_extra_fields = True

    LoginName = validators.UnicodeString(max=50, not_empty=True)
    LoginPwd = validators.String(not_empty=True)

    came_from = validators.UnicodeString()
Example #4
0
class ManageUserAddUserWrapper(validators.Schema):
    allow_extra_fields = True
    filter_extra_fields = True

    # need to add user validator when constructing

    manage_areas = validators.ForEach(validators.IntID())
    manage_external = validators.ForEach(validators.String(max=30))
    def __init__(self, request):
        validator = validators.String(max=30, not_empty=True)
        try:
            system_code = validator.to_python(request.matchdict.get('SystemCode'))
        except validators.Invalid:
            raise HTTPNotFound

        with request.connmgr.get_connection() as conn:
            cursor = conn.execute('EXEC sp_External_System_s ?', system_code)

            self.external_system = cursor.fetchone()

            cursor.close()

        if self.external_system is None:
            raise HTTPNotFound

        self.__acl__ = [
            (Allow, Everyone, 'view'),
            (Allow, 'area:admin', ('edit', 'view')),
            (Allow, 'area-external:' + self.external_system.SystemCode, ('edit', 'view')),
            DENY_ALL
        ]