Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

[AutoPR graphrbac/data-plane] [graphrbac]: fix bugs in permission grant apis #4662

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/services/graphManagement/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2018 Microsoft
Copyright (c) 2019 Microsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 14 additions & 0 deletions lib/services/graphManagement/lib/models/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,10 @@ export interface Permissions {
* The objectId of the Service Principal associated with the app
*/
clientId?: string;
/**
* The objectId of the permission grant
*/
objectId?: string;
/**
* Typically set to AllPrincipals
*/
Expand Down Expand Up @@ -1002,3 +1006,13 @@ export interface UserGetMemberGroupsResult extends Array<string> {
*/
export interface DomainListResult extends Array<Domain> {
}

/**
* Server response for get permissions grants
*/
export interface PermissionsListResult extends Array<Permissions> {
/**
* the URL to get the next set of results.
*/
odatanextLink?: string;
}
1 change: 1 addition & 0 deletions lib/services/graphManagement/lib/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ exports.ServicePrincipalListResult = require('./servicePrincipalListResult');
exports.UserListResult = require('./userListResult');
exports.UserGetMemberGroupsResult = require('./userGetMemberGroupsResult');
exports.DomainListResult = require('./domainListResult');
exports.PermissionsListResult = require('./permissionsListResult');
exports.discriminators = {
'DirectoryObject' : exports.DirectoryObject,
'DirectoryObject.Application' : exports.Application,
Expand Down
8 changes: 8 additions & 0 deletions lib/services/graphManagement/lib/models/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Permissions {
* Microsoft.DirectoryServices.OAuth2PermissionGrant
* @property {string} [clientId] The objectId of the Service Principal
* associated with the app
* @property {string} [objectId] The objectId of the permission grant
* @property {string} [consentType] Typically set to AllPrincipals
* @property {object} [principalId] Set to null if AllPrincipals is set
* @property {string} [resourceId] Service Principal Id of the resource you
Expand Down Expand Up @@ -59,6 +60,13 @@ class Permissions {
name: 'String'
}
},
objectId: {
required: false,
serializedName: 'objectId',
type: {
name: 'String'
}
},
consentType: {
required: false,
serializedName: 'consentType',
Expand Down
67 changes: 67 additions & 0 deletions lib/services/graphManagement/lib/models/permissionsListResult.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/

'use strict';

/**
* Server response for get permissions grants
*/
class PermissionsListResult extends Array {
/**
* Create a PermissionsListResult.
* @property {string} [odatanextLink] the URL to get the next set of results.
*/
constructor() {
super();
}

/**
* Defines the metadata of PermissionsListResult
*
* @returns {object} metadata of PermissionsListResult
*
*/
mapper() {
return {
required: false,
serializedName: 'PermissionsListResult',
type: {
name: 'Composite',
className: 'PermissionsListResult',
modelProperties: {
value: {
required: false,
serializedName: '',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'PermissionsElementType',
type: {
name: 'Composite',
className: 'Permissions'
}
}
}
},
odatanextLink: {
required: false,
serializedName: 'odata\\.nextLink',
type: {
name: 'String'
}
}
}
}
};
}
}

module.exports = PermissionsListResult;
135 changes: 125 additions & 10 deletions lib/services/graphManagement/lib/operations/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3988,7 +3988,7 @@ export interface OAuth2 {


/**
* Queries OAuth2 permissions for the relevant SP ObjectId of an app.
* Queries OAuth2 permissions grants for the relevant SP ObjectId of an app.
*
* @param {object} [options] Optional Parameters.
*
Expand All @@ -4000,14 +4000,14 @@ export interface OAuth2 {
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse<Permissions>} - The deserialized result object.
* @resolve {HttpOperationResponse<PermissionsListResult>} - The deserialized result object.
*
* @reject {Error|ServiceError} - The error object.
*/
getWithHttpOperationResponse(options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise<HttpOperationResponse<models.Permissions>>;
getWithHttpOperationResponse(options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise<HttpOperationResponse<models.PermissionsListResult>>;

/**
* Queries OAuth2 permissions for the relevant SP ObjectId of an app.
* Queries OAuth2 permissions grants for the relevant SP ObjectId of an app.
*
* @param {object} [options] Optional Parameters.
*
Expand All @@ -4024,24 +4024,24 @@ export interface OAuth2 {
*
* {Promise} A promise is returned.
*
* @resolve {Permissions} - The deserialized result object.
* @resolve {PermissionsListResult} - The deserialized result object.
*
* @reject {Error|ServiceError} - The error object.
*
* {ServiceCallback} optionalCallback(err, result, request, response)
*
* {Error|ServiceError} err - The Error object if an error occurred, null otherwise.
*
* {Permissions} [result] - The deserialized result object if an error did not occur.
* See {@link Permissions} for more information.
* {PermissionsListResult} [result] - The deserialized result object if an error did not occur.
* See {@link PermissionsListResult} for more information.
*
* {WebResource} [request] - The HTTP Request object if an error did not occur.
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
get(options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise<models.Permissions>;
get(callback: ServiceCallback<models.Permissions>): void;
get(options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.Permissions>): void;
get(options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise<models.PermissionsListResult>;
get(callback: ServiceCallback<models.PermissionsListResult>): void;
get(options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.PermissionsListResult>): void;


/**
Expand All @@ -4058,6 +4058,8 @@ export interface OAuth2 {
* @param {string} [options.body.clientId] The objectId of the Service
* Principal associated with the app
*
* @param {string} [options.body.objectId] The objectId of the permission grant
*
* @param {string} [options.body.consentType] Typically set to AllPrincipals
*
* @param {object} [options.body.principalId] Set to null if AllPrincipals is
Expand Down Expand Up @@ -4097,6 +4099,8 @@ export interface OAuth2 {
* @param {string} [options.body.clientId] The objectId of the Service
* Principal associated with the app
*
* @param {string} [options.body.objectId] The objectId of the permission grant
*
* @param {string} [options.body.consentType] Typically set to AllPrincipals
*
* @param {object} [options.body.principalId] Set to null if AllPrincipals is
Expand Down Expand Up @@ -4139,4 +4143,115 @@ export interface OAuth2 {
grant(options?: { body? : models.Permissions, customHeaders? : { [headerName: string]: string; } }): Promise<models.Permissions>;
grant(callback: ServiceCallback<models.Permissions>): void;
grant(options: { body? : models.Permissions, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.Permissions>): void;


/**
* Delete a OAuth2 permission grant for the relevant resource Ids of an app.
*
* @param {string} objectId The object ID of a permission grant.
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse<null>} - The deserialized result object.
*
* @reject {Error|ServiceError} - The error object.
*/
deleteMethodWithHttpOperationResponse(objectId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise<HttpOperationResponse<void>>;

/**
* Delete a OAuth2 permission grant for the relevant resource Ids of an app.
*
* @param {string} objectId The object ID of a permission grant.
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @param {ServiceCallback} [optionalCallback] - The optional callback.
*
* @returns {ServiceCallback|Promise} If a callback was passed as the last
* parameter then it returns the callback else returns a Promise.
*
* {Promise} A promise is returned.
*
* @resolve {null} - The deserialized result object.
*
* @reject {Error|ServiceError} - The error object.
*
* {ServiceCallback} optionalCallback(err, result, request, response)
*
* {Error|ServiceError} err - The Error object if an error occurred, null otherwise.
*
* {null} [result] - The deserialized result object if an error did not occur.
*
* {WebResource} [request] - The HTTP Request object if an error did not occur.
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
deleteMethod(objectId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise<void>;
deleteMethod(objectId: string, callback: ServiceCallback<void>): void;
deleteMethod(objectId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<void>): void;


/**
* Queries OAuth2 permissions grants for the relevant SP ObjectId of an app.
*
* @param {string} nextPageLink The NextLink from the previous successful call
* to List operation.
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse<PermissionsListResult>} - The deserialized result object.
*
* @reject {Error|ServiceError} - The error object.
*/
getNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise<HttpOperationResponse<models.PermissionsListResult>>;

/**
* Queries OAuth2 permissions grants for the relevant SP ObjectId of an app.
*
* @param {string} nextPageLink The NextLink from the previous successful call
* to List operation.
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
* request
*
* @param {ServiceCallback} [optionalCallback] - The optional callback.
*
* @returns {ServiceCallback|Promise} If a callback was passed as the last
* parameter then it returns the callback else returns a Promise.
*
* {Promise} A promise is returned.
*
* @resolve {PermissionsListResult} - The deserialized result object.
*
* @reject {Error|ServiceError} - The error object.
*
* {ServiceCallback} optionalCallback(err, result, request, response)
*
* {Error|ServiceError} err - The Error object if an error occurred, null otherwise.
*
* {PermissionsListResult} [result] - The deserialized result object if an error did not occur.
* See {@link PermissionsListResult} for more information.
*
* {WebResource} [request] - The HTTP Request object if an error did not occur.
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
getNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise<models.PermissionsListResult>;
getNext(nextPageLink: string, callback: ServiceCallback<models.PermissionsListResult>): void;
getNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.PermissionsListResult>): void;
}
Loading