AdminRoles

ДОВІДНИК З NODE-RED українською мовою

AdminRoles

Page

image-20230517143347380

Button1 (Create Role)

onClick


Button2 (Add Permissions To Role)

Disabled


onClick


ButtonGroup1

Disabled


Delete Menu

Menu Items

Delete Module from Role

onClick


Delete Role

onClick

{ { deleteRole.run(
    () => getRoles.run(), 
    () => {}
) } }

roles_table

Table Data


image-20230517145127235

FormButton2 (Close)

onClick


FormButton1 (Create)

onClick

{ { createRole.run(
    () => getRoles.run(
        ()=>closeModal("ModalCreateRole")), 
    () => {}
) } }

role_name_field

image-20230517145620270

modules_field (Modules:)

Options

{ { getModules.data.filter(
    i => !roles_table.selectedRow.permissions.some(
        e => i.name === e.module //імя модуля = є в імені в permissions 
    )
).map(
    (item)=>{
        return{
            label:item.name, 
            value:item._id
        }
    }
) } }

Default Value

[]

options_switch (Options:)

Options

[
  {
    "label": "Create",
    "value": "C"
  },
  {
    "label": "Read",
    "value": "R"
  },
  {
    "label": "Update",
    "value": "U"
  },
  {
    "label": "Delete",
    "value": "D"
  }
]

Default Selected Values

[
  "C","R", "U", "D"
]

Text7

Text

Role "" has pages: { { roles_table.selectedRow.permissions.map(
    i => `${i.module}`
).join(',  ') } }

FormButton5 (Submit)

onClick

{ { addModuleToRoles.run(
    () => getRoles.run(
        ()=>closeModal("ModalAddModule")
    ), () => {}
) } }

APIs

addModuleToRoles

POST /addModuleToRole

body

{
	"_id":"",
	"moduleValue": ,
	"moduleName": ,
	"options": 
}

Потік Node-RED

createRole

POST /createRole

body

{
		"name":""
}

Потік Node-RED

deleteModuleFromRole

DELETE /deleteModuleFromRole

body

{
	"_id": "",
	"moduleId": 
}

Потік Node-RED

deleteRole

DELETE /deleteRole

body

{
	"_id": ""
}

Потік Node-RED

getModules

GET /getModules

Потік Node-RED

getRoles

GET /getRoles

Потік Node-RED