정의
revokeRolesFromUser역할이 존재하는 데이터베이스의 사용자로부터 하나 이상의 역할을 제거합니다.
팁
In
mongosh, this command can also be run through thedb.revokeRolesFromUser()helper method.Helper methods are convenient for
mongoshusers, but they may not return the same level of information as database commands. In cases where the convenience is not needed or the additional return fields are required, use the database command.
호환성
이 명령은 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.
MongoDB Enterprise: MongoDB의 구독 기반 자체 관리 버전
MongoDB Community: MongoDB의 소스 사용 가능 무료 자체 관리 버전
중요
This command is not supported in MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.
구문
명령은 다음과 같은 구문을 가집니다:
db.runCommand( { revokeRolesFromUser: "<user>", roles: [ { role: "<role>", db: "<database>" } | "<role>", ... ], writeConcern: { <write concern> }, comment: <any> } )
명령 필드
이 명령은 다음 필드를 사용합니다.
필드 | 유형 | 설명 |
|---|---|---|
| 문자열 | 역할을 제거할 사용자입니다. |
| 배열 | 사용자에게서 제거할 역할입니다. |
| 문서 | |
| any | 선택 사항. 이 명령에 첨부할 사용자 제공 코멘트입니다. 설정되면 이 설명은 다음 위치에서 이 명령의 레코드와 함께 표시됩니다.
댓글은 유효한 모든 BSON types (문자열, 정수, 객체, 배열 등)이 될 수 있습니다. |
roles 필드에서 기본 제공 역할과 사용자 정의 역할을 모두 지정할 수 있습니다.
To specify a role that exists in the same database where revokeRolesFromUser runs, you can either specify the role with the name of the role:
"readWrite"
또는 다음과 같이 문서로 역할을 지정할 수도 있습니다.
{ role: "<role>", db: "<database>" }
다른 데이터베이스에 존재하는 역할을 지정하려면 문서를 사용하여 역할을 지정합니다.
필요한 액세스 권한
해당 데이터베이스에서 역할을 철회하려면 데이터베이스에 revokeRole 조치가 있어야 합니다.
예시
products 데이터베이스의 accountUser01 사용자는 다음과 같은 역할을 가집니다.
"roles" : [ { "role" : "assetsReader", "db" : "assets" }, { "role" : "read", "db" : "stock" }, { "role" : "readWrite", "db" : "products" } ]
The following revokeRolesFromUser command removes the two of the user's roles: the read role on the stock database and the readWrite role on the products database, which is also the database on which the command runs:
use products db.runCommand( { revokeRolesFromUser: "accountUser01", roles: [ { role: "read", db: "stock" }, "readWrite" ], writeConcern: { w: "majority" } } )
이제 products 데이터베이스의 사용자 accountUser01 에게는 역할이 하나만 남아 있습니다.
"roles" : [ { "role" : "assetsReader", "db" : "assets" } ]