Hierarchy

  • Manager

Properties

create: ((ro) => string)

Type declaration

    • (ro): string
    • 创建角色

      Parameters

      Returns string

      Example

      import * as r from "role"
      let mgr = r.newManager()
      let id = mgr.create({ name: "test", label: "test" })
      let testRole = mgr.getByID(id)

      @param ro 角色创建参数 - 必选字段labelname可选字段reportTodescription
      @return 角色ID
getByID: ((id) => Role)

Type declaration

    • (id): Role
    • 获取角色

      Parameters

      • id: string

        角色ID

      Returns Role

      返回Role对象

getByName: ((name) => Role)

Type declaration

    • (name): Role
    • 获取角色

      Parameters

      • name: string

        角色名称

      Returns Role

      返回Role对象

getList: ((qo?) => Role[])

Type declaration

    • (qo?): Role[]
    • 获取角色列表

      Parameters

      Returns Role[]

      角色列表(不返回用户列表、管理者列表)

remove: ((id) => void)

Type declaration

    • (id): void
    • 删除角色

      不能删除被 用户、其他角色、组或者分享规则 所引用的角色。

      Parameters

      • id: string

        角色ID

      Returns void

update: ((role) => void)

Type declaration

    • (role): void
    • 更新角色元数据

      仅修改角色的元数据,不会修改用户的角色身份

      Parameters

      • role: Role

        RoleOptions接口,必须包含id。

      Returns void