accessReviewInstanceDecisionItem: recordAllDecisions
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
作为访问评审的审阅者,记录分配给你且与指定的主体或资源 ID 匹配 的 accessReviewInstanceDecisionItem 的决定。 如果未指定任何 ID,则决策将应用于作为审阅者的每 一个 accessReviewInstanceDecisionItem 。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
AccessReview.Read.All、AccessReview.ReadWrite.All
委派(个人 Microsoft 帐户)
不支持。
应用
AccessReview.Read.All、AccessReview.ReadWrite.All
HTTP 请求
POST /identityGovernance/accessReviews/decisions/filterByCurrentUser(on='reviewer')/recordAllDecisions
名称
说明
Authorization
Bearer {token}。必需。
Content-Type
application/json. Required.
请求正文
在请求正文中,提供参数的 JSON 表示形式。
下表显示了可用于此操作的参数。
参数
类型
说明
决定
字符串
要提供的决定。 可能的值是 Approve, Deny. DontKnow
理由
字符串
提供决策的理由。
principalId
String
如果提供,与 principalId 匹配的所有决策项都将记录此决策。
resourceId
String
如果提供,与 resourceId 匹配的所有决策项都将记录此决策。
响应
如果成功,此操作返回 204 No Content 响应代码。
示例
请求
POST https://graph.microsoft.com/beta/identityGovernance/accessReviews/decisions/filterByCurrentUser(on='reviewer')/recordAllDecisions
Content-Type: application/json
{
"decision": "Deny",
"justification": "Alice switched teams and no longer works with this group",
"principalId": "2043848d-e422-473c-8607-88a3319ff491",
"resourceId": "733ef921-89e1-4d7e-aeff-83612223c37e"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var decision = "Deny";
var justification = "Alice switched teams and no longer works with this group";
var principalId = "2043848d-e422-473c-8607-88a3319ff491";
var resourceId = "733ef921-89e1-4d7e-aeff-83612223c37e";
await graphClient.IdentityGovernance.AccessReviews.Decisions
.FilterByCurrentUser(null)
.RecordAllDecisions(decision,justification,principalId,resourceId)
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const recordAllDecisions = {
decision: 'Deny',
justification: 'Alice switched teams and no longer works with this group',
principalId: '2043848d-e422-473c-8607-88a3319ff491',
resourceId: '733ef921-89e1-4d7e-aeff-83612223c37e'
};
await client.api('/identityGovernance/accessReviews/decisions/filterByCurrentUser(on='reviewer')/recordAllDecisions')
.version('beta')
.post(recordAllDecisions);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/identityGovernance/accessReviews/decisions/filterByCurrentUser(on='reviewer')/recordAllDecisions"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
NSString *decision = @"Deny";
payloadDictionary[@"decision"] = decision;
NSString *justification = @"Alice switched teams and no longer works with this group";
payloadDictionary[@"justification"] = justification;
NSString *principalId = @"2043848d-e422-473c-8607-88a3319ff491";
payloadDictionary[@"principalId"] = principalId;
NSString *resourceId = @"733ef921-89e1-4d7e-aeff-83612223c37e";
payloadDictionary[@"resourceId"] = resourceId;
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
String decision = "Deny";
String justification = "Alice switched teams and no longer works with this group";
String principalId = "2043848d-e422-473c-8607-88a3319ff491";
String resourceId = "733ef921-89e1-4d7e-aeff-83612223c37e";
graphClient.identityGovernance().accessReviews().decisions()
.filterByCurrentUser(AccessReviewInstanceDecisionItemFilterByCurrentUserParameterSet
.newBuilder()
.withOn(null)
.build())
.recordAllDecisions(AccessReviewInstanceDecisionItemRecordAllDecisionsParameterSet
.newBuilder()
.withDecision(decision)
.withJustification(justification)
.withPrincipalId(principalId)
.withResourceId(resourceId)
.build())
.buildRequest()
.post();
响应
注意: 为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 204 No Content