# (c) cavaliba.com


# -------------------------------------------------------------
# user pipeline - v4.0
# -------------------------------------------------------------


- classname: _pipeline
  keyname: user_import_csv
  displayname: user_import_csv
  description: Pipeline to import user in utf-8 csv format (,)
  content: |
      csv_delimiter: ','
      #encoding: 'ISO-8859-1'
      encoding: 'utf-8'
      classname: user
      keyfield: keyname
      tasks: 
          - field_lower: ['', email, login]

# ------------------------------
# user default dataview
# ------------------------------

- classname: _dataview
  keyname: user_default
  target_class: user
  displayname: User - default
  description: Default dataview for User Schema
  content: |
    columns:
      - Login:
          from: keyname
      - firstname
      - lastname
      - email
      - manager
      - last_login
      - last_update
      - last_sync


# -------------------------------------------------------------
# user schema - v4.0
# -------------------------------------------------------------

- classname: _schema
  keyname: user
  displayname: Users
  order: 202
  page: Asset Management    
  _options:
      icon: fa-user-plus
      field_hide_from_edit:
      - last_login
      p_admin: p_user_admin
      p_create: p_user_create
      p_read: p_user_read
      p_update: p_user_update
      p_delete: p_user_delete

  # builtin fields: keyname, displayname, is_enabled

  last_login:
    displayname: Last Login
    order: 5
    dataformat: datetime

  firstname:
    displayname: First Name
    order: 10
    dataformat: string

  lastname:
    displayname: Last Name
    order: 20
    dataformat: string

  description:
    displayname: Description
    order: 25
    dataformat: string

  email:
    displayname: Email
    order: 30
    dataformat: string

  mobile:
    displayname: Mobile
    order: 40
    dataformat: string

  external_id:
    displayname: External ID
    order: 50
    dataformat: string

  manager:
    displayname: Manager
    order: 55
    dataformat: user

  want_notifications:
    displayname: Want Notifications
    order: 60
    dataformat: boolean

  want_24:
    displayname: Want 24h Notifications
    order: 70
    dataformat: boolean

  want_email:
    displayname: Want Email
    order: 80
    dataformat: boolean

  want_sms:
    displayname: Want SMS
    order: 90
    dataformat: boolean

  secondary_email:
    displayname: Secondary Email
    order: 110
    dataformat: string

  secondary_mobile:
    displayname: Secondary Mobile
    order: 120
    dataformat: string



# -------------------------------------------------------------
# ADMIN USER
# -------------------------------------------------------------

# admin: all permissions by default (in code)
- classname: user
  keyname: admin
  displayname: Built-in Global Admin user



