mirror of https://github.com/abpframework/abp
parent
dafd75ed8f
commit
6d4c98a096
@ -0,0 +1,70 @@
|
||||
# React Native入门
|
||||
|
||||
ABP平台提供了[React Native](https://reactnative.dev/)模板用于开发移动应用程序.
|
||||
|
||||
当你按照[入门文档](Getting-Started.md)中所述**创建新应用程序**时,解决方案默认将React Native应用程序包含在 `react-native` 文件夹中.
|
||||
|
||||
## 配置你的本地IP地址
|
||||
|
||||
运行在Android模拟器或真机上的React Native应用程序无法连接到 `localhost` 上的后.要修复此问题,需要在本地IP上运行后端.
|
||||
|
||||
{{ if Tiered == "No"}}
|
||||

|
||||
|
||||
* 打开 `.HttpApi.Host` 文件夹下的 `appsettings.json` 文件. 将 `SelfUrl` 和 `Authority` 属性的 `localhost` 替换为你本地的IP地址.
|
||||
* 打开 `.HttpApi.Host/Properties` 文件夹下的 `launchSettings.json` 文件. 将 `applicationUrl` 属性的 `localhost` 替换为你本地的IP地址.
|
||||
|
||||
{{ else if Tiered == "Yes" }}
|
||||
|
||||

|
||||
|
||||
* 打开 `.IdentityServer` 文件夹下的 `appsettings.json` 文件. 将 `SelfUrl` 属性的 `localhost` 替换为你本地的IP地址.
|
||||
* 打开 `.IdentityServer/Properties` 文件夹下的 `launchSettings.json` 文件. 将 `applicationUrl` 属性的 `localhost` 替换为你本地的IP地址.
|
||||
* 打开 `.HttpApi.Host` 文件夹下的 `appsettings.json` 文件. 将 `Authority` 属性的 `localhost` 替换为你本地的IP地址.
|
||||
* 打开 `.HttpApi.Host/Properties` 文件夹下的 `launchSettings.json` 文件. 将 `applicationUrl` 属性的 `localhost` 替换为你本地的IP地址.
|
||||
|
||||
{{ end }}
|
||||
|
||||
按照**运行HTTP API Host (服务端口)**那样运行后端.
|
||||
|
||||
> React Native应用程序不信任自动生成的.NET HTTPS证书,你可以在开发期间使用HTTP.
|
||||
|
||||
在 `react-native` 文件夹打开命令行终端,输入 `yarn` 命令(我们推荐使用[yarn](https://yarnpkg.com/)包管理, `npm install` 在大多数情况下也可以工作).
|
||||
|
||||
```bash
|
||||
yarn
|
||||
```
|
||||
|
||||
* 打开 `react-nativer` 文件夹下的 `Environment.js` 文件. 将 `apiUrl` 和 `issuer` 属性的 `localhost` 替换为你本地的IP地址:
|
||||
|
||||

|
||||
|
||||
{{ if Tiered == "Yes" }}
|
||||
|
||||
> 确保 `issuer` 与正在运行的 `.IdentityServer` 项目匹配, `apiUrl` 与正在运行的 `.HttpApi.Host` 项目匹配.
|
||||
|
||||
{{else}}
|
||||
|
||||
> 确保 `issuer` 和 `apiUrl` 与正在运行的 `.HttpApi.Host` 项目匹配
|
||||
|
||||
{{ end }}
|
||||
|
||||
等到所有node模块加载成功, 执行 `yarn start` (或 `npm start`) 命令:
|
||||
|
||||
```bash
|
||||
yarn start
|
||||
```
|
||||
|
||||
等待Expo CLI启动后Expo CLI在 `http://localhost:19002/` 地址要开管理页面.
|
||||
|
||||

|
||||
|
||||
在上面的管理界面中,可以通过使用[Expo Client](https://expo.io/tools#client)扫描二维码,使用Android模拟器,iOS模拟器或真机来启动应用程序.
|
||||
|
||||
> 请参阅expo.io上的[Android Studio模拟器](https://docs.expo.io/workflow/android-simulator/)和[iOS模拟器文档](https://docs.expo.io/workflow/ios-simulator/).
|
||||
|
||||

|
||||
|
||||
输入用户名 **admin**,密码 **1q2w3E*** 登录到应用程序.
|
||||
|
||||
应用程序已经启动并执行,你可以基于该启动模板开发应用程序.
|
@ -1,3 +1,5 @@
|
||||
# 身份管理模块
|
||||
|
||||
身份模块基于Microsoft Identity 库用于管理[组织单元](Organization-Units.md), 角色, 用户和他们的权限.
|
||||
|
||||
参阅 [源码](https://github.com/abpframework/abp/tree/dev/modules/identity). 文档很快会被完善.
|
@ -0,0 +1,47 @@
|
||||
# 组织单元管理
|
||||
|
||||
组织单元(OU)是"身份模块"的一部分,用于**对用户和实体进行分层分组**.
|
||||
|
||||
### OrganizationUnit 实体
|
||||
|
||||
OU由 **OrganizationUnit** 实体表示. 实体有以下基本属性:
|
||||
|
||||
- **TenantId**: OU租户的ID,为null代表是宿主OU.
|
||||
- **ParentId**: OU的父亲Id,为null为根OU.
|
||||
- **Code**: 租户唯一的分层字符串代码.
|
||||
- **DisplayName**: OU的显示名称.
|
||||
|
||||
OrganizationUnit实体的主键(Id)是 **Guid** 类型,派生自[**FullAuditedAggregateRoot**](../Entities.md)类.
|
||||
|
||||
#### Organization 树
|
||||
|
||||
因为OU可以有父亲,租户所有的OU是一个**树**结构. 树有一些规则:
|
||||
|
||||
- 可以有多个根(`ParentId` 为 `null`).
|
||||
- OU的第一级子级数有限制(面说明的固定OU代码单位长度).
|
||||
|
||||
#### OU Code
|
||||
|
||||
OU代码由OrganizationUnit Manager自动生成和维护. 看起来像这样的字符串:
|
||||
|
||||
"**00001.00042.00005**"
|
||||
|
||||
此代码可用于轻松查询数据库中OU的所有子级(递归). 代码有一些规则:
|
||||
|
||||
- 必须[租户](../Multi-Tenancy.md)**唯一**的.
|
||||
- 同一OU的所有子代均以**父OU的代码开头**.
|
||||
- 它是**固定长度**的,并且基于树中OU的级别,如示例中所示.
|
||||
- 虽然OU代码是唯一的,但是如果移动OU,它是**可更改的**.
|
||||
- 你必须通过Id而不是代码引用OU.
|
||||
|
||||
### OrganizationUnit Manager
|
||||
|
||||
可以注入 **OrganizationUnitManager** 管理OU. 常见的用例有:
|
||||
|
||||
- 创建,更改或删除OU.
|
||||
- 在OU树中移动OU.
|
||||
- 获取有关OU树及其项的信息
|
||||
|
||||
#### 多租户
|
||||
|
||||
`OrganizationUnitManager` 设置为一次性为 **单个租户** 工作,默认是 **当前租户**.
|
Loading…
Reference in new issue