npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pubinfo-pr/module-rbac

v0.238.1

Published

Pubinfo 的权限与后台管理模块。它既提供 RBAC 相关页面和组件,也负责根据配置注册权限管理路由、初始化路由视图数据,并建立模块内部的 WebSocket 同步能力。

Readme

@pubinfo/module-rbac

Pubinfo 的权限与后台管理模块。它既提供 RBAC 相关页面和组件,也负责根据配置注册权限管理路由、初始化路由视图数据,并建立模块内部的 WebSocket 同步能力。

它在做什么

  • 提供 rbac() 模块注册函数
  • 支持两种页面来源:
    • 本地静态页面配置
    • dynamic 资源管理驱动的动态页面
  • 注册并过滤一整套后台管理路由
  • 初始化视图路由数据和 WebSocket 管理器
  • 导出常用选择器、资源选择组件、字典工具、路由系统工具和 view store

基本用法

import { rbac } from '@pubinfo/module-rbac';

export function setupRbac() {
  return rbac({
    request: basic,
    id: 'RBAC',
    pages: 'dynamic',
  });
}

如果使用本地注册路由:

rbac({
  request: basic,
  sort: 100,
  pages: {
    AuthorityManage: {
      Resource: true,
      Role: true,
    },
  },
});

页面范围

从路由定义看,模块默认覆盖这些后台域:

  • AuthorityManage: 资源、角色、角色组、数据权限、组织、用户、租户
  • SystemManage: 字典、岗位、区域、分组
  • SettingManage: 主题、布局、页面动画、分页、菜单、Tabbar、工具栏、面包屑、其他设置
  • SafeManage: 黑白名单、安全设置、水印设置
  • LogManage: 登录历史、操作历史

主要导出

  • rbac
  • ResourceSelector
  • OrgUserSelector 相关导出
  • useWebSocketManager
  • useViewStore
  • 字典工具
  • 路由系统工具
  • RbacOptions / RbacPages

工作方式

  • 如果 pages !== 'dynamic',模块会调用 defineAsyncRoutes() 注入过滤后的本地路由
  • 模块启动时会执行 viewStore.initializeRouteData()
  • 同时会初始化 useWebSocketManager(),用于模块内部实时同步
  • 之后再异步加载 routeSystem 完成路由系统初始化

适用场景

适合需要完整后台权限管理能力的 Pubinfo 项目,而不只是简单的按钮鉴权。这个模块本质上是“权限系统 + 后台管理页面集合”。