0

したがって、RouterOS php ライブラリを使用して登録ユーザーのプロファイルをアクティブにする次の関数があります。

 public function activateProfile($username)
    {
        $activationQuery = new Query(
            '/tool/user-manager/user/create-and-activate-profile',
            [
                '=user=' . $username,
                '=customer=admin',
                '=profile=profile1',
            ]
        );
        $response = $this->query($activationQuery)->read(false);
        print("Activating Profile...");
        print_r($response);
    }

しかし、私は以下のエラーメッセージを受け取り続けます

Activating Profile...Array ( [0] => !trap [1] => =message=no such command [2] => !done )
4

1 に答える 1

0

素早い返信

属性 word を渡すことはできませんuser。代わりに、ユーザーを識別する番号を渡す必要があります。ドキュメントに記載されているように、最初に作成してから作成してアクティブ化するプロファイルを作成することをお勧めします。

説明

RouterOS APIコマンド ワードは、CLI に厳密に従います。

あなたの合言葉は/tool/user-manager/user/create-and-activate-profile.

あなたの属性の単語は=user、、、=customerです=profile

User_Manager から CLI や wiki と比較できます。=user= が利用可能です。

[admin@106] /tool user-manager user> create-and-activate-profile                                    

<numbers> -- List of item numbers
customer -- 
profile -- 



デモストレーション

/tool/user-manager/user/add
=customer=admin
=disabled=no
=password=test
=shared-users=1
=username=test

<<< /tool/user-manager/user/add
<<< =customer=admin
<<< =disabled=no
<<< =password=test
<<< =shared-users=1
<<< =username=test
<<< 
>>> !done
>>> =ret=*1
>>> 

<<< /tool/user-manager/user/create-and-activate-profile
<<< =numbers=*1
<<< =customer=admin
<<< =profile=a
<<< 
>>> !done
>>> 


于 2021-02-24T22:44:31.730 に答える