# PEDM承認コマンド

### 概要

ここでは、PEDMの特権昇格承認リクエストを管理するKeeperコマンダーのコマンドを扱います。承認では、実行前に管理者の承認が必要な特権昇格リクエストを扱います。これらのコマンドで、保留中のリクエストの確認や、承認・却下・削除による対応が行えます。

このセクションで扱うコマンドは以下のとおりです。

* [**承認リクエスト一覧コマンド**](#approval-list-command)
* [**承認対応コマンド**](#approval-action-command)

### 使い方

`pedm approval command [--options]`

***

### 承認リクエスト一覧コマンド <a href="#approval-list-command" id="approval-list-command"></a>

特権昇格の承認リクエストを、ステータス、詳細、有効期限の情報とともにすべて表示します。承認ステータスで絞り込み、保留、承認済み、却下済み、または期限切れのリクエストを確認できます。

<details>

<summary>DotNet CLI</summary>

**コマンド:** 近日公開

</details>

<details>

<summary>DotNet SDK</summary>

**関数:** 近日公開

</details>

<details>

<summary>Power Commander</summary>

**コマンド:** 近日公開

</details>

<details>

<summary>Python CLI</summary>

**コマンド:** `pedm approval list`

**エイリアス:** `pedm approval l`

**フラグ:**

| フラグ        | 説明                                                         |
| ---------- | ---------------------------------------------------------- |
| `--type`   | 承認ステータスで絞り込む (choices: approved, denied, pending, expired) |
| `--format` | 出力形式 - json、csv、tableのいずれか                                 |
| `--output` | 指定ファイルに保存する                                                |

**例:**

```
My Vault> pedm approval list --type pending

Approval UID: approval_abc123
Approval Type: PrivilegeElevation
Status: Pending
Agent UID: agent_xyz789
Account Info: User=john.doe
Application Info: Process=powershell.exe
Justification: System maintenance
Expire In: 300
Created: 2024-11-05 10:30:00
```

</details>

<details>

<summary>Python SDK</summary>

**関数:**

```python
from keepersdk.plugins.pedm import admin_plugin

plugin = admin_plugin.PedmPlugin(enterprise_loader)
approval_list = plugin.approvals.get_all_entities()
```

</details>

### 承認対応コマンド <a href="#approval-action-command" id="approval-action-command"></a>

特権昇格の承認リクエストに対し、承認・却下・削除の操作を行います。一括操作に対応し、@approved、@denied、@expired、@pendingなどの特殊値でリクエストのグループを対象にできます。

<details>

<summary>DotNet CLI</summary>

**コマンド:** 近日公開

</details>

<details>

<summary>DotNet SDK</summary>

**関数:** 近日公開

</details>

<details>

<summary>Power Commander</summary>

**コマンド:** 近日公開

</details>

<details>

<summary>Python CLI</summary>

**コマンド:** `pedm approval action`

**エイリアス:** `pedm approval a`

**フラグ:**

| フラグ         | 説明                                                               |
| ----------- | ---------------------------------------------------------------- |
| `--approve` | 承認するリクエストUID。繰り返し指定可                                             |
| `--deny`    | 却下するリクエストUID。繰り返し指定可                                             |
| `--remove`  | 削除するリクエストUID、または @approved、@denied、@expired、@pendingの特殊値。繰り返し指定可 |

**例:**

```
My Vault> pedm approval action --approve approval_abc123

Approval request approved successfully
```

```
My Vault> pedm approval action --deny approval_def456

Approval request denied successfully
```

```
My Vault> pedm approval action --remove @expired

All expired approval requests removed successfully
```

</details>

<details>

<summary>Python SDK</summary>

**関数:**

```python
from keepersdk.plugins.pedm import admin_plugin

plugin = admin_plugin.PedmPlugin(enterprise_loader)

def verify_uid(uids: Any) -> Optional[List[bytes]]:
    if isinstance(uids, str):
        uids = [uids]
    if isinstance(uids, list):
        to_uid = []
        for uid in uids:
            approve_uid = utils.base64_url_decode(uid)
            if len(approve_uid) == 16:
                to_uid.append(approve_uid)
            else:
                logger.warning(f'Invalid UID: {uid}')
        if len(to_uid) > 0:
            return to_uid
    return None

list_approve = ['names or uids of approval requests to approve']
list_deny = ['names or uids of approval requests to deny']
list_remove = ['names or uids of approval requests to remove']
to_approve = verify_uid([list('')])
to_deny = verify_uid(kwargs.get('deny'))
to_remove = kwargs.get('remove')
if to_remove:
    if isinstance(to_remove, str):
        to_remove = [to_remove]
    to_remove_set: Set[bytes] = set()
    to_resolve = []
    for uid in to_remove:
        if uid == '@approved':
            to_remove_set.update(
                (utils.base64_url_decode(x.approval_uid) for x in plugin.storage.approval_status.get_all_entities() if x.approval_status == NotificationCenter_pb2.NAS_APPROVED))
        elif uid == '@denied':
            to_remove_set.update(
                (utils.base64_url_decode(x.approval_uid) for x in plugin.storage.approval_status.get_all_entities() if x.approval_status == NotificationCenter_pb2.NAS_DENIED))
        elif uid == '@pending':
            to_remove_set.update(
                (utils.base64_url_decode(x.approval_uid) for x in plugin.storage.approval_status.get_all_entities() if x.approval_status == NotificationCenter_pb2.NAS_UNSPECIFIED))
        else:
            to_resolve.append(uid)
    if len(to_resolve) > 0:
        to_remove = verify_uid(to_resolve)
        if isinstance(to_remove, list):
            to_remove_set.update(to_remove)
    to_remove = list(to_remove_set)

status_rs = plugin.modify_approvals(to_approve=to_approve, to_deny=to_deny, to_remove=to_remove)
```

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/keeperpam/jp/commander-sdk/keeper-commander-sdks/sdk-command-reference/pedm-commands/pedm-approval-commands.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
