コード例 #1
0
    def get_schema(cls):
        """Return the InputEx schema for the roles editor."""
        schema = schema_fields.FieldRegistry(
            'Role', description='role')

        schema.add_property(schema_fields.SchemaField(
            'version', '', 'string', optional=True, hidden=True))
        schema.add_property(schema_fields.SchemaField(
            'name', 'Name', 'string', optional=False,
            description=messages.ROLE_NAME_DESCRIPTION))
        schema.add_property(schema_fields.SchemaField(
            'description', 'Description', 'text', optional=True,
            description=messages.ROLE_DESCRIPTION_DESCRIPTION))
        # TODO(gdejonghe) Use user.id instead of user.email
        schema.add_property(schema_fields.SchemaField(
            'users', 'User Emails', 'text',
            description=messages.ROLE_USER_EMAILS_DESCRIPTION))

        subschema = schema.add_sub_registry('modules', 'Permission Modules')

        for module in Roles.get_modules():
            cls._add_module_permissions_schema(subschema, module.name)
        cls._add_module_permissions_schema(subschema, cls.INACTIVE_MODULES)

        return schema
コード例 #2
0
    def get_schema(cls):
        """Return the InputEx schema for the roles editor."""
        schema = schema_fields.FieldRegistry('Role', description='role')

        schema.add_property(
            schema_fields.SchemaField('version',
                                      '',
                                      'string',
                                      optional=True,
                                      hidden=True))
        schema.add_property(
            schema_fields.SchemaField('name', 'Name', 'string', optional=True))
        schema.add_property(
            schema_fields.SchemaField('description',
                                      'Description',
                                      'text',
                                      optional=True))
        # TODO(gdejonghe) Use user.id instead of user.email
        schema.add_property(
            schema_fields.SchemaField('users',
                                      'User Emails',
                                      'text',
                                      optional=True))

        subschema = schema.add_sub_registry('modules', 'Permission Modules')

        for module in Roles.get_modules():
            cls._add_module_permissions_schema(subschema, module.name)
        cls._add_module_permissions_schema(subschema, cls.INACTIVE_MODULES)

        return schema