Each setting is simple value, combined from multiple sources. For example, value can_create_forum_post depends on:

When we need to calculate setting value:

  1. user provides setting name (or list) AND additional parameter (user_id, forum_id, ...)
  2. (value,type) are fetched from every store, defined in schema (type = OR/AND)
  3. fetched values are combined (first, by OR, then by AND)

Setting stores

For every setting, store returns "vector":

Every store type is defined by combination of parameters, needed to extract setting. That's unique for well-designed system.

In database, each store is usually binded to 'setting' field of appropriate document. It real life, you should not care about store deal, because you'll reuse existing ones. Settings are defined in config yaml files. Each file can contain multiple settings. We prefer to group those by roles or by store.

Note, that many fields from yaml config are used only in Admin Control Panel.

Setting definition

category_key - used to combine settings on long page. group_key - used to combine settings in tabs & groups.

Setting group definition

Global setting are combined in tabs & groups on control panel. That does not affect settings logic, and used only in interface

i18n

Paths for settings localizations:

Note, we considet, that settings, groups & categories has unique IDs. So, start group id with "grp" and categories with "cat" prefixes.

Example

---
setting_schemas:
  global:
    threads_per_page:
      type: number
      default: 30
      group: forum

    posts_per_page:
      type: number
      default: 25
      group: thread

setting_groups:
  tab_system:
    priority: 0
  grp_forum:
    parent: tab_system
    priority: 10
  grp_topic:
    parent: tab_system
    priority: 20
i18n:
  en-US:
    admin:
      setting:
        tab_system: System
        grp_forum: Forum
        grp_thread: Thread

        threads_per_page: Threads per page
        threads_per_page_help: Default number of displayed thread 

        posts_per_page: Posts per page
        posts_per_page_help: Default number of displayed posts

API

TBD