1 Star 0 Fork 196

wang__shuai / SAAS-UPMS

forked from LC / SAAS-UPMS 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

SAAS权限管理系统

基于 Spring cloudnacosvue的前后端分离分布式微服务Saas权限管理系统。包含运维/运营、C端用户、B端租户成员三套用户体系的权限管理,切换机构、切换角色,支持四个级别的页面接口访问权限校验、四个级别的数据权限的设置和校验,机构角色和机构用户两种用户授权模式,微服务接口管理、接口访问权限动态设置、接口访问量统计功能,前端工程、前端页面、页面按钮管理配置功能,产品线管理功能,租户开通工单功能,租户预制角色管理功能,系统、用户、机构、租户配置功能,预制配置功能,日志管理功能,任务调度功能,微服接口访问量统计功能,C端用户实时IM功能。

演示地址

租的阿里云的服务器,内存有限,只搭了一套正式环境,下面运维/运营只给了查看权限,没有操作权限。更多的功能建议自己下载代码运行后试试吧。

基于该权限管理系统,配套开发了C端博客系统。

如果觉得不错的话,可以给我一个start嘛?

文件结构

  • server:后端工程
    • nacos:注册中心
    • tools:通用工具包
    • operate:运营/用户后端
    • gateway:接口网关
    • log:日志后端
    • sync:任务调度后端
    • chat:实时IM后端
    • tenant:租户管理后端
  • ui:前端工程
    • common:前端公用组件
    • operate:运营/运维前端
    • me:个人前端
    • tenant:租户权限管理前端
  • nginxnginx配置文件
  • sql: 初始化脚本

一、介绍

企业级多租户后台权限管理框架(SAAS)。

技术架构图.jpg

二、主要功能:

1 后端微服务接口管理->前端工程管理->产品管理

这三个管理功能是依次依赖的,为后期的权限管理提供基础数据,同时也是便于清晰直白的体现整个系统的功能,利于后期系统的维护。

后端微服务接口管理

功能:

1)用于管理查看所有的微服务接口信息,用于后期服务增多,接口增多后,进行系统优化时提供参考。

2)进行接口访问权限的设置。

3)接口访问量统计。

4)给前端管理提供接口数据支持。

微服务工程只需要引入base-client包,就可以自动添加、更新该微服务所有的接口信息,无需手动操作。在产品管理里进行配置了后,通过刷新产品授权限制信息按钮就可以自动完成接口访问授权的设置。

TODO: 接口文档自动生成,接口自动化测试。

微服务接口管理.png

前端工程管理

主要作用:直观的体现系统一共有哪些前端工程,每个前端工程有几个页面,每个页面可以调用哪些接口。

前端和页面数据由前端开发人员将各自前端功能开发完成后,手动进行录入,接口数据从后端服务接口中手动选择。

给产品管理提供页面和按钮数据。

前端工程管理.png

产品管理

产品是面向客户群体的,系统功能是围绕产品进行开发的,所以在这里进行产品的设置和定义,同时将对应的系统功能进行绑定。

产品绑定的菜单中,分类导航菜单需要手动进行创建,菜单页面从前端工程管理里选取。

产品管理.png

2 产品管理

产品管理详细说明

3 角色管理

角色管理详细说明

4 运营运维、用户、租户三个用户群体的权限管理,数据隔离

三个用户群体的机构、用户、角色单独进行管理。

租户属于2B业务,租户之间数据隔离,可以为不同的租户开通不同的2B产品。

TODO: 租户数据库级别的数据隔离;租户开通产品访问量统计;访问量阈值设定。

5 细粒度接口权限控制

接口调用权限:无限制、只能内部调用、管理员登录|授权访问,用户登录|授权访问,租户成员登录|授权访问。

接口数据权限:所有机构数据、所属机构及下级机构数据、所属机构数据、个人数据

接口权限控制详细说明

6 自定义数据权限管理控制

在数据权限管理界面,可以根据具体的数据权限,对机构或机构成员进行数据权限授权。

目前控制的数据权限有

1)机构数据

2)数据权限管理的数据权限

3)微服务接口里的微服务数据权限

4)前端工程数据权限

数据权限详细说明

7 其他功能说明

三、模块化设计与使用

业务概述业务概述.jpg

服务对应功能

前后端服务 对应功能 是否开源
/server/operate
/server/gateway
/ui/operate
管理员权限管理
微服务接口管理
前端管理
产品管理
网关管理
配置管理
文件管理
/server/log
/server/sync
系统日志管理
任务管理
任务日志管理
/ui/me 用户权限管理
/server/chat 聊天系统
通讯录
/server/tenant
/ui/tenant
租户权限管理
/server/worldTree
/ui/web
世界树和辩论堂相关功能
/server/article
/ui/article
/ui/article-info
文章相关功能

/server/nacos、operate、gateway和/me/operate是基础微服务,只运行这四个服务,即可拥有运维运营及管理员主要功能。

/server/log、sync这两个后端服务,提供日志和任务调度功能,不启动这两个微服务的情况下,请确保其他服务配置文件中日志推送标志不为true(默认为false) log.posh=false ,为true的情况下,每个微服务都会将各自的日志信息存储到redis中,然后靠sync和log服务从redis中取出进行消费。

/ui/me,运行这个前端服务,即可使用C端用户功能。

/server/chat,运行这个后端服务,C端用户即可使用聊天和通讯录功能,前端在/ui/me中

/server/tenant,/ui/tenant,运行这两个服务后,可以使用租户管理相关功能。租户功能除了依赖之前的基础服务外,还依赖C端用户的功能,因为租户成员账号是 C端用户的一个身份,一个C端用户可以有多个租户成员账号。

:当然要使用上述的功能,还得开通相应的权限才行

四、技术技巧

密码RSA前端加密,后端解密

vue、nuxt添加百度统计功能

五、运行和部署

server和ui文件内的工程都是独立的,正规公司都是每个工程都单独一个git工程,我这为了方便放一个git里了。

  1. 创建数据库、导入数据

  2. 启动redis、nacos

    # redis自行启动,nacos在/server/nacos/bin/ 目录中有配套的启动文件 
    # 注意linux下单机启动命令如下
    sh startup.sh -m standalone
  3. 配置启动/server/operate、gateway

    operate是基础核心服务,gateway是接口网关,所有前端接口调用都走gateway,gateway是动态网关,网关信息从redis中的获取(operate启动时将网关信息从数据库读取然后存储到redis中)。

  4. 启动/ui/operate

    # /ui/operate
    npm install
    npm run dev

    启动成功后访问 http://localhost:8081/admin/login 登录即可 运维运营用户名/密码 admin/123456aA. 此时除了日志功能、任务调用功能访问会报404,租户功能不能正常使用外,其他功能都能正常使用了。

  5. 启动/ui/me

    # /ui/me
    npm install
    npm run dev

    启动成功后访问 http://localhost:8083/me/login 登录 C端用户名/密码 15739575703/123456aA. 此时处理聊天功能、租户功能外,C端功能都能使用。

  6. 配置启动/server/chat

    启动成功后,C端聊天功能能够正常使用

  7. 配置启动/server/log、sync

    启动成功后,运维运营端日志功能和任务调度功能能够正常使用了

  8. 配置启动/server/tenant

  9. 启动/ui/tenant

    启动成功后访问,http://localhost:8084/tenant/login 租户成员账号/密码 15739575703/a123456 此时,租户功能能够正常使用了。

    注意:这是多租户系统,所以每个租户的登录地址都应该是这样的 http://{租户代码}.域名.com/tenant/login,通过二级域名的方式进行登录,然后将二级域名作为一个参数传递给后端服务,用于辨识是那个租户,所以本地启动时,需要在/ui/tenant/config/index.js文件中,将要用于登录的租户成员账号对应的租户代码进行手动填入,模拟二级域名缺失的参数

    'use strict'
    // Template version: 1.3.1
    // see http://vuejs-templates.github.io/webpack for documentation.
    
    const path = require('path')
    
    function onProxyReq (proxyReq, req, res) {
      // 本地开发时,只能使用 如下设置的 B端租户代码 对应的B端账号进行登录
      proxyReq.setHeader('LOGIN-TENANT-CODE', 'applyTenantTest13');
      proxyReq.setHeader('ACCESS-SOURCE', 'nc-nginx');
    }
    module.exports = {
      dev: {
        // Paths
        assetsSubDirectory: 'static',
        assetsPublicPath: '/',
        proxyTable: {
          '/tenantApi': {
            target: 'http://localhost:1081/',
            changeOrigin: true,
            // 代理响应事件
            onProxyReq: onProxyReq,
            pathRewrite: {
              '^/': '/'
            }
          }
        },
    
        // Various Dev Server settings
        host: 'localhost', // can be overwritten by process.env.HOST
        port: 8084, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
    ...
    }

六、结束

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

基于 Spring cloud、nacos、vue的前后端分离分布式微服务Saas权限管理系统。包含运维/运营、C端用户、B端租户成员三套用户体系的权限管理,切换机构、切换角色,支持四个级别的页面接口访问权限校验、四个级别的数据权限的设置和校验,机构角色和机构用户两种用户授权模式,微服务接口管理、接口访问权限动态设置、接口访问量统计功能,前端工程、前端页面、页面按钮管理配置功能,产品线管理功能,租户开通工单功能,租户预制角色管理功能,系统、用户、机构、租户配置功能,预制配置功能,日志管理功能,任务调度功能,微服接口访问量统计功能,C端用户实时IM功能。 展开 收起
Java
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/wang__shuai/nodecollege-upms.git
git@gitee.com:wang__shuai/nodecollege-upms.git
wang__shuai
nodecollege-upms
SAAS-UPMS
master

搜索帮助