-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bookingbusiness namespace updates, examples fixes for directory API
- Loading branch information
Showing
9 changed files
with
89 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
""" | ||
How to grant and revoke delegated permissions for an app using Microsoft Graph. | ||
Delegated permissions, also called scopes or OAuth2 permissions, allow an app to call an API | ||
on behalf of a signed-in user. | ||
https://learn.microsoft.com/en-us/graph/permissions-grant-via-msgraph?tabs=http&pivots=grant-delegated-permissions | ||
""" | ||
|
||
from office365.graph_client import GraphClient | ||
from tests import ( | ||
test_client_id, | ||
test_client_secret, | ||
test_tenant, | ||
) | ||
|
||
client = GraphClient.with_client_secret(test_tenant, test_client_id, test_client_secret) | ||
|
||
|
||
resource = client.service_principals.get_by_name("Microsoft Graph") | ||
app_role = "Bookings.Read.All" | ||
result = resource.get_application_permissions(test_client_id).execute_query() | ||
if ( | ||
len([cur_app_role for cur_app_role in result.value if cur_app_role == app_role]) | ||
== 0 | ||
): | ||
print("Application permission '{0}' is not granted".format(app_role)) | ||
else: | ||
print(result.value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters