---
### TREE ###
IMAppLib_Model_TreeType:
  ContentTreeType:
    id: content
    name: Content Tree
    description: Manages content nodes
    managing_class: IMAppLib_Tree_TypeManager_Content

IMAppLib_Model_ContentType:
  CopyNodeContentType:
    id: copynode
    title: Copy Node
    description: Copies source subtrees into another node
    managing_class: IMAppLib_Node_Manager_CopyNode

IMAppLib_Model_Tree:
  ContentTree:
    title: Content Tree
    Type: ContentTreeType

IMAppLib_Model_Node:
  Node1:
    id: 1
    title: cat1
    Tree: ContentTree
    lft: 1
    rgt: 12
    level: 0
  Node1_1:
    id: 2
    title: cat1.1
    Tree: ContentTree
    lft: 2
    rgt: 3
    level: 1
  Node1_2:
    id: 3
    title: cat1.2
    Tree: ContentTree
    lft: 4
    rgt: 9
    level: 1
  Node1_2_1:
    id: 4
    title: cat1.2.1
    Tree: ContentTree
    lft: 5
    rgt: 6
    level: 2
  Node1_2_2:
    id: 5
    title: cat1.2.2
    Tree: ContentTree
    lft: 7
    rgt: 8
    level: 2
  Node1_3:
    id: 6
    title: cat1.3
    Tree: ContentTree
    lft: 10
    rgt: 11
    level: 1
  Node2:
    id: 7
    title: cat2
    Tree: ContentTree
    lft: 13
    rgt: 14
    level: 0
  Node3:
    id: 8
    title: cat3
    Tree: ContentTree
    lft: 15
    rgt: 30
    level: 0
  Node3_1:
    id: 9
    title: cat3.1
    Tree: ContentTree
    lft: 16
    rgt: 17
    level: 1
  Node3_2:
    id: 10
    title: cat3.2
    Tree: ContentTree
    lft: 18
    rgt: 27
    level: 1
  Node3_2_1:
    id: 11
    title: cat3.2.1
    Tree: ContentTree
    lft: 19
    rgt: 26
    level: 2
  Node3_2_1_1:
    id: 12
    title: cat3.2.1.1
    Tree: ContentTree
    lft: 20
    rgt: 25
    level: 3
  Node3_2_1_1_1:
    id: 13
    title: cat3.2.1.1.1
    Tree: ContentTree
    lft: 21
    rgt: 24
    level: 4
  Node3_2_1_1_1_1:
    id: 14
    title: cat3.2.1.1.1.1
    Tree: ContentTree
    lft: 22
    rgt: 23
    level: 5
  Node3_3:
    id: 15
    title: cat3.3
    Tree: ContentTree
    lft: 28
    rgt: 29
    level: 1

### AUTH ###
IMAppLib_Model_AuthMethod:
  HashedPasswordAuthMethod:
    id: hashed-password
    description: Allows authentication for a user by providing a password
    managing_class: IMAppLib_Auth_Method_HashedPassword

IMAppLib_Model_User:
  AdminUser:
    id: 1
    name: admin
    is_locked: false
    login_failures: 0

IMAppLib_Model_UserAuthMethod:
  AdminPasswordAuth:
    User: AdminUser
    AuthMethod: HashedPasswordAuthMethod

IMAppLib_Model_HashedPassword:
  AdminPassword:
    User: AdminUser
    hash: d57d51c04f4c48c07e26b5273a5256ed36a74238 # = admin

IMAppLib_Model_Group:
  AdminGroup:
    id: 1
    name: admin
  UserGroup:
    id: 1000
    name: users

IMAppLib_Model_AccessControlPrincipal:
  AdminGroupPrincipal:
    # AdminGroup
    principal_id: 1
    principal_type: group
    lft: 1
    rgt: 4
    level: 0
  AdminUserPrincipal:
    # AdminUser
    principal_id: 1
    principal_type: user
    lft: 2
    rgt: 3
    level: 1
  UserGroupPrincipal:
    # UserGroup
    principal_id: 1000
    principal_type: group
    lft: 5
    rgt: 8
    level: 0
  -
    # AdminUser
    principal_id: 1
    principal_type: user
    lft: 6
    rgt: 7
    level: 1

### ACL ###
IMAppLib_Model_AccessControlPrivilege:
# super privilege
  SuperPrivilege:
    name: super
    description: Denotes the right to do everything
# basic CRUD privileges
  AddPrivilege:
    name: add
    description: Privilege to add something on a resource
  EditPrivilege:
    name: edit
    description: Privilege to edit something on a resource
  DeletePrivilege:
    name: delete
    description: Privilege to delete something from a resource
  ListPrivilege:
    name: list
    description: Privilege to list something in a resource
  ManageAuthPrivilege:
    name: manageauth
    description: Privilege to manage authentication methods
  MutatePrivilege:
    name: mutate
    description: Privilege to edit or delete something on a resource
# login privileges
  LoginCliPrivilege:
    name: login-cli
    description: Login to the cli service is permitted
  LoginHttpPrivilege:
    name: login-http
    description: Login to any http service is permitted

IMAppLib_Model_AccessControlResource:
  SystemResource:
    name: system
    description: The main resource of the application
  UserIdentitiesResource:
    name: identities.user
    description: Resource managing all user identities
  GroupIdentitiesResource:
    name: identities.group
    description: Resource managing all group identities
  AclRightResource:
    name: acl.right
    description: Resource managing rights of the acl
  AclPrivilegeResource:
    name: acl.privilege
    description: Resource managing privileges of the acl
  AuthmethodsResource:
    name: authmethods
    description: Resource managing authentication methods

IMAppLib_Model_AccessControlResourcePrivilege:
  SystemSuperResourcePrivilege:
    Privilege: SuperPrivilege
    Resource: SystemResource
  SystemLoginCliResourcePrivilege:
    Privilege: LoginCliPrivilege
    Resource: SystemResource
  SystemLoginHttpResourcePrivilege:
    Privilege: LoginHttpPrivilege
    Resource: SystemResource
  UserIdentitiesAddResourcePrivilege:
    Privilege: AddPrivilege
    Resource: UserIdentitiesResource
  UserIdentitiesEditResourcePrivilege:
    Privilege: EditPrivilege
    Resource: UserIdentitiesResource
  UserIdentitiesDeleteResourcePrivilege:
    Privilege: DeletePrivilege
    Resource: UserIdentitiesResource
  UserIdentitiesListResourcePrivilege:
    Privilege: ListPrivilege
    Resource: UserIdentitiesResource
  UserIdentitiesManageAuthResourcePrivilege:
    Privilege: ManageAuthPrivilege
    Resource: UserIdentitiesResource
  GroupIdentitiesAddResourcePrivilege:
    Privilege: AddPrivilege
    Resource: GroupIdentitiesResource
  GroupIdentitiesEditResourcePrivilege:
    Privilege: EditPrivilege
    Resource: GroupIdentitiesResource
  GroupIdentitiesDeleteResourcePrivilege:
    Privilege: DeletePrivilege
    Resource: GroupIdentitiesResource
  GroupIdentitiesListResourcePrivilege:
    Privilege: ListPrivilege
    Resource: GroupIdentitiesResource
  AclRightListResourcePrivilege:
    Privilege: ListPrivilege
    Resource: AclRightResource
  AclRightMutateResourcePrivilege:
    Privilege: MutatePrivilege
    Resource: AclRightResource
  AclPrivilegeListResourcePrivilege:
    Privilege: ListPrivilege
    Resource: AclPrivilegeResource
  AclPrivilegeMutateResourcePrivilege:
    Privilege: MutatePrivilege
    Resource: AclPrivilegeResource
  AuthmethodsListResourcePrivilege:
    Privilege: ListPrivilege
    Resource: AuthmethodsResource

IMAppLib_Model_AccessControlRight:
# basic CRUD rights
  AddRight:
    name: add
    description: Right to add something to a node
  EditRight:
    name: edit
    description: Right to edit a node
  DeleteRight:
    name: delete
    description: Right to delete a node
  SeeRight:
    name: see
    description: Right to see a node

IMAppLib_Model_AccessControlPrivilegeEntry:
  -
    principal_id: 1000
    principal_type: group
    Resource: SystemResource
    Privilege: LoginHttpPrivilege
    allow: true
  -
    principal_id: 1
    principal_type: group
    Resource: SystemResource
    Privilege: SuperPrivilege
    allow: true
  -
    principal_id: 1
    principal_type: user
    Resource: SystemResource
    Privilege: SuperPrivilege
    allow: true

### TASKS ###
IMAppLib_Model_Task:
  AclTask:
    name: acl
    class: IMAppLib_Api_Cli_AccessControl
    context: cli
  GroupsTask:
    name: groups
    class: IMAppLib_Api_Cli_Identity_Group
    context: cli
  UsersTask:
    name: users
    class: IMAppLib_Api_Cli_Identity_User
    context: cli
  PluginsTask:
    name: plugins
    class: IMAppLib_Api_Cli_Plugin
    context: cli
  PrivilegesTask:
    name: privileges
    class: IMAppLib_Api_Cli_Privilege
    context: cli
  AuthMethodTask:
    name: authmethods
    class: IMAppLib_Api_Cli_Auth_Methods
    context: cli
  AuthTask:
    name: auth
    class: IMAppLib_Api_Http_Auth
    context: http
  ClientContextTask:
    name: clientcontext
    class: IMAppLib_Api_Http_ClientContext
    context: http
  LocaleTask:
    name: locale
    class: IMAppLib_Api_Http_Locale
    context: http

IMAppLib_Model_TaskAlias:
  GroupTaskAlias:
    name: group
    Task: GroupsTask
    context: cli
  UserTaskAlias:
    name: user
    Task: UsersTask
    context: cli
  PluginTaskAlias:
    name: plugin
    Task: PluginsTask
    context: cli
  PrivilegeTaskAlias:
    name: privilege
    Task: PrivilegesTask
    context: cli
