'use strict';
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
const resolve = require('resolve');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
const ESLintPlugin = require('eslint-webpack-plugin');
const paths = require('./paths');
const modules = require('./modules');
const getClientEnvironment = require('./env');
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
const ForkTsCheckerWebpackPlugin =
process.env.TSC_COMPILE_ON_ERROR === 'true'
? require('react-dev-utils/ForkTsCheckerWarningWebpackPlugin')
: require('react-dev-utils/ForkTsCheckerWebpackPlugin');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const createEnvironmentHash = require('./webpack/persistentCache/createEnvironmentHash');
// Source maps are resource heavy and can cause out of memory issue for large source files.
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
const reactRefreshRuntimeEntry = require.resolve('react-refresh/runtime');
const reactRefreshWebpackPluginRuntimeEntry = require.resolve(
'@pmmmwh/react-refresh-webpack-plugin'
);
const babelRuntimeEntry = require.resolve('babel-preset-react-app');
const babelRuntimeEntryHelpers = require.resolve(
'@babel/runtime/helpers/esm/assertThisInitialized',
{ paths: [babelRuntimeEntry] }
);
const babelRuntimeRegenerator = require.resolve('@babel/runtime/regenerator', {
paths: [babelRuntimeEntry],
});
// Some apps do not need the benefits of saving a web request, so not inlining the chunk
// makes for a smoother build process.
const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false';
const emitErrorsAsWarnings = process.env.ESLINT_NO_DEV_ERRORS === 'true';
const disableESLintPlugin = process.env.DISABLE_ESLINT_PLUGIN === 'true';
const imageInlineSizeLimit = parseInt(
process.env.IMAGE_INLINE_SIZE_LIMIT || '10000'
);
// Check if TypeScript is setup
const useTypeScript = fs.existsSync(paths.appTsConfig);
// Check if Tailwind config exists
const useTailwind = fs.existsSync(
path.join(paths.appPath, 'tailwind.config.js')
);
// Get the path to the uncompiled service worker (if it exists).
const swSrc = paths.swSrc;
// style files regexes
const cssRegex = /\.css$/;
const cssModuleRegex = /\.module\.css$/;
const sassRegex = /\.(scss|sass)$/;
const sassModuleRegex = /\.module\.(scss|sass)$/;
const hasJsxRuntime = (() => {
if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
return false;
}
try {
require.resolve('react/jsx-runtime');
return true;
} catch (e) {
return false;
}
})();
// This is the production and development configuration.
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
module.exports = function (webpackEnv) {
const isEnvDevelopment = webpackEnv === 'development';
const isEnvProduction = webpackEnv === 'production';
// Variable used for enabling profiling in Production
// passed into alias object. Uses a flag if passed into the build command
const isEnvProductionProfile =
isEnvProduction && process.argv.includes('--profile');
// We will provide `paths.publicUrlOrPath` to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
// Get environment variables to inject into our app.
const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
const shouldUseReactRefresh = env.raw.FAST_REFRESH;
// common function to get style loaders
const getStyleLoaders = (cssOptions, preProcessor) => {
const loaders = [
isEnvDevelopment && require.resolve('style-loader'),
isEnvProduction && {
loader: MiniCssExtractPlugin.loader,
// css is located in `static/css`, use '../../' to locate index.html folder
// in production `paths.publicUrlOrPath` can be a relative path
options: paths.publicUrlOrPath.startsWith('.')
? { publicPath: '../../' }
: {},
},
{
loader: require.resolve('css-loader'),
options: cssOptions,
},
{
// Options for PostCSS as we reference these options twice
// Adds vendor prefixing based on your specified browser support in
// package.json
loader: require.resolve('postcss-loader'),
options: {
postcssOptions: {
// Necessary for external CSS imports to work
// https://github.com/facebook/create-react-app/issues/2677
ident: 'postcss',
config: false,
plugins: !useTailwind
? [
'postcss-flexbugs-fixes',
[
'postcss-preset-env',
{
autoprefixer: {
flexbox: 'no-2009',
},
stage: 3,
},
],
// Adds PostCSS Normalize as the reset css with default options,
// so that it honors browserslist config in package.json
// which in turn let's users customize the target behavior as per their needs.
'postcss-normalize',
]
: [
'tailwindcss',
'postcss-flexbugs-fixes',
[
'postcss-preset-env',
{
autoprefixer: {
flexbox: 'no-2009',
},
stage: 3,
},
],
],
},
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
},
},
].filter(Boolean);
if (preProcessor) {
loaders.push(
{
loader: require.resolve('resolve-url-loader'),
options: {
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
root: paths.appSrc,
},
},
{
loader: require.resolve(preProcessor),
options: {
sourceMap: true,
},
}
);
}
return loaders;
};
return {
target: ['browserslist'],
// Webpack noise constrained to errors and warnings
stats: 'errors-warnings',
mode: isEnvProduction ? 'production' : isEnvDevelopment && 'development',
// Stop compilation early in production
bail: isEnvProduction,
devtool: isEnvProduction
? shouldUseSourceMap
? 'source-map'
: false
: isEnvDevelopment && 'cheap-module-source-map',
// These are the "entry points" to our application.
// This means they will be the "root" imports that are included in JS bundle.
entry: paths.appIndexJs,
output: {
// The build folder.
path: paths.appBuild,
// Add /* filename */ comments to generated require()s in the output.
pathinfo: isEnvDevelopment,
// There will be one main bundle, and one file per asynchronous chunk.
// In development, it does not produce real files.
filename: isEnvProduction
? 'static/js/[name].[contenthash:8].js'
: isEnvDevelopment && 'static/js/bundle.js',
// Th
rbac11111111
需积分: 0 36 浏览量
更新于2024-01-08
收藏 33KB ZIP 举报
标题“rbac11111111”可能指的是一个关于“角色基础访问控制(Role-Based Access Control,RBAC)”的项目或系统,其中的数字可能是版本号或者是内部的标识符。描述中的“112312”没有提供具体的信息,可能是随机字符或者时间戳,因此在解释知识点时,我们主要依据标签和压缩包内的文件名。
标签“123”看起来不太明确,可能是一个占位符或者是项目的特定代码。在这种情况下,我们需要依赖文件名来推断更具体的IT知识点。
压缩包内的四个文件名:“Api”、“src”、“config”和“login”,每个都代表了软件开发中的关键部分:
1. **Api**:通常代表应用程序接口(Application Programming Interface)。API是软件之间交互的约定,允许不同的组件或服务之间进行通信。在RBAC系统中,API可能会包含用于创建、更新、删除和查询用户角色、权限等相关操作的函数或方法。
2. **src**:这是源代码目录,存放着项目的原始编程文件。在这里,我们可以预期找到用各种编程语言(如Java、Python、JavaScript等)编写的实现RBAC逻辑的代码。
3. **config**:配置文件通常存储系统设置、数据库连接信息、环境变量等。在RBAC系统中,配置文件可能会定义角色、权限的默认设置,以及如何映射用户到角色的规则。
4. **login**:这可能指的是登录模块,负责用户身份验证和授权。在RBAC系统中,登录功能是至关重要的,因为它确定用户的角色,并根据这些角色授予相应的访问权限。
结合以上信息,我们可以推测这个项目是一个RBAC系统,其中包括API供其他系统或组件调用,源代码实现RBAC的核心功能,配置文件管理系统的配置信息,以及登录模块处理用户认证。这个系统可能用于企业级应用,以确保不同用户群体只能访问他们被授权的操作和数据。
在实际应用中,RBAC模型通过定义角色,将权限与角色关联,然后将角色分配给用户,以此实现对资源的访问控制。这样的设计提高了安全性,简化了权限管理,同时降低了因直接分配权限给用户而可能导致的复杂性和错误。
开发一个RBAC系统时,需要考虑的关键点包括:
- 角色设计:如何定义和分类角色,使其能够覆盖所有必要的权限。
- 权限模型:定义何种类型的权限,如读取、写入、执行等。
- 角色-权限关系:如何有效地关联角色和权限,以及如何更新这些关系。
- 用户-角色关系:用户如何被分配到角色,是否可以拥有多个角色。
- 权限继承:角色之间的权限继承关系,以便于管理和维护。
- 审计和日志:记录用户的访问行为,以便于监控和审计。
- 动态权限调整:系统应能根据业务需求动态地调整用户角色和权限。
实现RBAC时,开发者需要注意遵循最佳实践,如最小权限原则,即每个角色和用户只赋予完成其工作所需的最少权限,以减少潜在的安全风险。此外,还要考虑系统的可扩展性和灵活性,以适应未来可能出现的新需求或变化。
z820328478
- 粉丝: 0
- 资源: 2
最新资源
- 【岗位说明】公司营销部职位说明书(共7个职位).doc
- 【岗位说明】某公司市场部岗位说明书.doc
- 【岗位说明】某销售总公司各岗位的职责标准.doc
- 【岗位说明】市场部研展工作流程图及具体流程.docx
- 【岗位说明】市场部校园助理职责.doc
- 【岗位说明】市场部职能说明书.doc
- 【岗位说明】市场人员岗位职责.doc
- 【岗位说明】市场营销部部门职责.doc
- 【岗位说明】市场营销部岗位职责.doc
- 【岗位说明】市场营销部各岗位说明书.doc
- 【岗位说明】售后经理岗位职责.doc
- 【岗位说明】市场营销类职位说明书.doc
- 【岗位说明】市场营销部总经理职位说明书.doc
- 【岗位说明】市场与销售类岗位说明书.doc
- 【岗位说明】项目部职能说明书.doc
- 【岗位说明】销售部岗位职责01.doc