# CloudCC 简档使用总结

简档（Profile）用于定义 CloudCC 系统中用户的权限集合，包括对象访问权限、字段权限、功能权限等。

---

## 快速开始（CLI 命令）

### 支持的简档操作

| 操作 | 说明 |
|------|------|
| `create` | 创建自定义简档 |
| `get` | 查询简档列表 |
| `delete` | 删除自定义简档 |

---

## CLI 命令详解

### 创建简档

创建一个新的自定义简档，基于现有简档进行克隆。

```bash
cloudcc create profile <path> <profileName> [description]
```

**参数说明：**

| 参数 | 必填 | 说明 |
|------|------|------|
| `path` | 是 | 项目路径，`.` 表示当前目录 |
| `profileName` | 是 | 简档名称 |
| `description` | 否 | 简档描述 |

**示例：**

```bash
# Create a profile
cloudcc create profile . "Sales Manager Profile"

# Create a profile with a description
cloudcc create profile . "Sales Rep Profile" "Permission configuration for the sales team"
```

---

### 查询简档列表

获取当前环境中的所有简档列表。

```bash
cloudcc get profile <projectPath> [encodedCondJson]
```

**参数说明：**

| 参数 | 必填 | 说明 |
|------|------|------|
| `projectPath` | 否 | 项目路径，默认当前目录 |
| `encodedCondJson` | 否 | URI 编码后的查询条件 JSON |

**示例：**

```bash
# Get all profiles
cloudcc get profile .

# With query conditions
cloudcc get profile . '%7B%22type%22%3A%22custom%22%7D'
```

---

### 删除简档

删除指定的自定义简档。

```bash
cloudcc delete profile <projectPath> <profileId>
```

**参数说明：**

| 参数 | 必填 | 说明 |
|------|------|------|
| `projectPath` | 否 | 项目路径，默认当前目录 |
| `profileId` | 是 | 简档 ID |

**示例：**

```bash
# Delete a specified profile
cloudcc delete profile . a0I9D000000XXXXUAI
```

---

## 完整工作流示例

### 场景：为销售团队创建新的权限简档

```bash
# 1. Confirm the project is initialized (cloudcc-cli.config.js exists)
cat cloudcc-cli.config.js

# 2. Query existing profiles
cloudcc get profile .

# 3. Create a new Sales Manager profile
cloudcc create profile . "Sales Manager Profile" "Permission configuration for sales team managers"

# 4. Verify the profile was created successfully
cloudcc get profile .

# 5. Delete it if needed
# cloudcc delete profile . <profileId>
```

---

*文档版本：1.0 | 最后更新：2026-03-26*
