DATA - Class/Schema

DataClass and Schema

A Schema describes a DataClass with global and custom fields.

Global Fields for all classes

These fields are default fields, alwas available to all DataClass schema.

  • keyname - unique name of the class ; slug, no special chars ; must be unique

  • _displayname - a short string for humans

  • _page - string, page name in the Web UI displaying the list of available classes

  • _order - int, display order in the Web UI

  • _icon - string, name of a FontAwsome Icon to display in UI

  • role…. - strings, name of a Cavaliba Role to control authorizations on that class/schema

    • _role_show : the class is visible in the UI
    • _role_access :
    • _role_read : Instances of this class can be viewed
    • _role_create : Instances of this class can be created
    • _role_update : Instances of this class can be updated (if they exist)
    • _role_delete : Instances of this class can be deleted
    • _role_onoff : Instances can be enabled/disabled in this class
    • _role_import : Allow import (YAML/JSON) of instances from this class
    • _role_export : Allow export (YAML/JSON) of instances from this class

Custom Fields

Each DataClass Schema can have zero or more custom fields. These fields can be single-valued or multi-valued. They have a type from one of the available field types below.

Field name must be a valid slug string (unique, no special chararcter) within the DataClass schema.

Available field types:

  • string
  • int
  • float
  • date
  • boolean
  • ipv4
  • text
  • enumerate
  • sirene_data
  • sirene_group
  • sirene_user

YAML Example

The _action attribute describes the operation to be performed on the object.


_schema:test_class:
    #_action: create
    _displayname: TestClass
    _is_enabled: yes
    _order: 900
    _page: Test        
    _icon: fa-question
    _role_show: role_data_test_ro
    _role_access: role_data_test_ro
    _role_read: role_data_test_ro
    _role_create: role_data_test_rw
    _role_update: role_data_test_rw
    _role_delete: role_data_test_rw
    _role_onoff: role_data_test_rw
    _role_import: role_data_test_admin
    _role_export: role_data_test_admin

    description:
       displayname: Description
       dataformat: string
       dataformat_ext: ""
       cardinal_min: 0
       cardinal_max: 1
       default : ""
    mystring:
        displayname: MyString
        dataformat: string
        description: description ...            
        order: 100
        page: Strings
    myint:
        displayname: MyInt
        dataformat: int
        order: 200
        description: description ...            
        page: Numbers
    myfloat:
        displayname: MyFloat
        dataformat: float
        description: description ...
        order: 210
        page: Numbers
    myboolean:
        displayname: MyBoolean
        dataformat: boolean
        description: check to activate !
        order: 300
        page: Booleans
    mydate:
        displayname: MyDate
        description: format YYYY-MM-DD
        dataformat: date
        order: 400
        page: Other
    myipv4:
        displayname: MyIPV4
        dataformat: ipv4
        description: A.B.C.D or A.B.C.D/mask
        order: 410
        page: Other

# ---

    my_sirene_group:
        displayname: MysireneGroup
        dataformat: sirene_group
        description: select cavaliba UserGroup object(s)
        order: 500
        page: Objects
        cardinal_max: 0

# ---

    my_sirene_app:      
        displayname: MySireneData(app)
        dataformat: sirene_data
        dataformat_ext: app
        description: Select Cavaliba Data object(s)
        order: 510
        page: Objects
        cardinal_max: 0
# ---

    my_enumerate_ok_ko:      
        displayname: MyEnumerate_OK_KO
        dataformat: enumerate
        dataformat_ext: enum_OK_KO
        description: Choose a value
        order: 505
        page: Static-Enum
        cardinal_min: 0
        cardinal_max: 1

    my_enumerate_ok_ko_na:
        displayname: MyEnumerate_OK_KO_NA
        dataformat: enumerate
        dataformat_ext: enum_OK_KO_NA
        description: Choose a value
        order: 510
        page: Static-Enum
        cardinal_min: 0
        cardinal_max: 1



    my_enumerate_abc:      
        displayname: MyEnumerate_ABC
        dataformat: enumerate
        dataformat_ext: enum_ABC
        description: Choose an enum_ABC value
        order: 520
        page: Static-Enum
        cardinal_min: 0
        cardinal_max: 1

    my_enumerate_abc_multi:      
        displayname: MyEnumerate_ABC_Multi
        dataformat: enumerate
        dataformat_ext: enum_ABC
        description: Choose enum_ABC values
        order: 525
        page: Static-Enum
        cardinal_min: 0
        cardinal_max: 0


    my_enumerate_abcde:      
        displayname: Maturite_ABCDE
        dataformat: enumerate
        dataformat_ext: maturite_ABCDE
        description: Choose an maturite_ABCDE value
        order: 530
        page: Static-Enum
        cardinal_min: 0
        cardinal_max: 1

    my_enumerate_abcde_multi:      
        displayname: Maturite_ABCDE_Multi
        dataformat: enumerate
        dataformat_ext: maturite_ABCDE
        description: Choose maturite_ABCDE values
        order: 535
        page: Static-Enum
        cardinal_min: 0
        cardinal_max: 0

# ---

    my_user:      
        displayname: My Sirene User
        dataformat: sirene_user
        description: Select a Cavaliba User
        order: 550
        page: Orga
        cardinal_min: 0
        cardinal_max: 1

    my_user_multi:
        displayname: My Sirene User Multi
        dataformat: sirene_user
        description: Select one or more Cavaliba Users
        order: 551
        page: Orga
        cardinal_min: 0
        cardinal_max: 0