Office365-REST-Python-Client 2.5.13__py3-none-any.whl → 2.5.14__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {Office365_REST_Python_Client-2.5.13.dist-info → Office365_REST_Python_Client-2.5.14.dist-info}/METADATA +1 -1
- {Office365_REST_Python_Client-2.5.13.dist-info → Office365_REST_Python_Client-2.5.14.dist-info}/RECORD +135 -78
- office365/booking/business/business.py +13 -0
- office365/booking/business/collection.py +8 -4
- office365/communications/callrecords/collection.py +42 -0
- office365/communications/callrecords/direct_routing_log_row.py +5 -0
- office365/communications/cloud_communications.py +2 -3
- office365/directory/applications/application.py +16 -2
- office365/directory/applications/required_resource_access.py +23 -0
- office365/directory/applications/resource_access.py +26 -0
- office365/directory/authentication/methods/details.py +29 -0
- office365/directory/authentication/methods/root.py +8 -0
- office365/directory/permissions/scope.py +15 -3
- office365/directory/policies/authentication_strength.py +21 -0
- office365/directory/policies/update_allowed_combinations_result.py +5 -0
- office365/directory/security/alerts/evidence.py +2 -1
- office365/directory/security/alerts/malware_evidence.py +5 -0
- office365/directory/security/alerts/process_evidence.py +5 -0
- office365/directory/security/attacksimulations/user.py +5 -0
- office365/directory/security/attacksimulations/user_coverage.py +3 -0
- office365/directory/security/attacksimulations/users/details.py +6 -1
- office365/directory/serviceprincipals/service_principal.py +86 -37
- office365/onedrive/driveitems/driveItem.py +1 -1
- office365/onedrive/driveitems/retention_label.py +33 -0
- office365/onedrive/driveitems/retention_label_settings.py +7 -0
- office365/onedrive/sitepages/base.py +3 -0
- office365/onedrive/sitepages/collection.py +12 -0
- office365/onedrive/sitepages/site_page.py +9 -9
- office365/onedrive/sites/archival_details.py +5 -0
- office365/onedrive/sites/site_collection.py +10 -1
- office365/onedrive/workbooks/functions/functions.py +23 -0
- office365/partners/billing/__init__.py +0 -0
- office365/planner/tasks/check_list_item.py +5 -1
- office365/runtime/client_object.py +15 -7
- office365/runtime/client_object_collection.py +2 -2
- office365/runtime/client_result.py +2 -0
- office365/runtime/client_value.py +1 -1
- office365/runtime/csom/request.py +11 -0
- office365/runtime/types/exceptions.py +18 -0
- office365/search/acronym.py +10 -0
- office365/search/aggregation_option.py +6 -0
- office365/search/answer.py +9 -0
- office365/search/entity.py +67 -14
- office365/search/entity_type.py +28 -0
- office365/search/request.py +32 -3
- office365/sharepoint/apps/access_requests.py +5 -0
- office365/sharepoint/apps/management/__init__.py +0 -0
- office365/sharepoint/apps/management/principal_info.py +9 -0
- office365/sharepoint/authpolicy/events/collection.py +28 -0
- office365/sharepoint/authpolicy/events/role_assignment_resource_payload.py +4 -0
- office365/sharepoint/documentmanagement/document_id.py +28 -3
- office365/sharepoint/files/file.py +11 -4
- office365/sharepoint/files/versions/event.py +9 -0
- office365/sharepoint/flows/permissions.py +30 -0
- office365/sharepoint/listhome/favorite_item.py +9 -0
- office365/sharepoint/listitems/listitem.py +79 -4
- office365/sharepoint/listitems/update_parameters.py +4 -1
- office365/sharepoint/lists/data_parameters.py +5 -0
- office365/sharepoint/lists/exporter.py +73 -0
- office365/sharepoint/lists/list.py +148 -61
- office365/sharepoint/lists/render_data_parameters.py +31 -0
- office365/sharepoint/lists/version_policy_manager.py +5 -0
- office365/sharepoint/migration/copy_migration_options.py +5 -0
- office365/sharepoint/portal/groups/site_manager.py +32 -0
- office365/sharepoint/portal/project/__init__.py +9 -0
- office365/sharepoint/portal/userprofiles/documentsshared/__init__.py +0 -0
- office365/sharepoint/portal/userprofiles/documentsshared/with_group.py +38 -0
- office365/sharepoint/portal/userprofiles/documentsshared/with_person.py +9 -0
- office365/sharepoint/portal/userprofiles/sharedwithme/__init__.py +0 -0
- office365/sharepoint/{userprofiles → portal/userprofiles}/sharedwithme/document.py +1 -1
- office365/sharepoint/{userprofiles → portal/userprofiles}/sharedwithme/items.py +3 -1
- office365/sharepoint/publishing/pages/coauth_state.py +8 -0
- office365/sharepoint/publishing/pages/page.py +11 -0
- office365/sharepoint/publishing/pages/stream_content.py +9 -0
- office365/sharepoint/publishing/pages/stream_data.py +8 -0
- office365/sharepoint/quotamanagement/consumer/non_quota_backfill_api.py +8 -0
- office365/sharepoint/request.py +3 -0
- office365/sharepoint/search/administration/site_content_processing_info_provider.py +11 -0
- office365/sharepoint/search/ranking_labeling.py +1 -0
- office365/sharepoint/search/reports/abandonedqueries/__init__.py +0 -0
- office365/sharepoint/search/reports/abandonedqueries/data.py +0 -0
- office365/sharepoint/search/reports/abandonedqueries/item.py +5 -0
- office365/sharepoint/search/reports/noresult/__init__.py +0 -0
- office365/sharepoint/search/reports/numberofqueries/__init__.py +0 -0
- office365/sharepoint/search/reports/top_queries.py +7 -0
- office365/sharepoint/search/reports/topqueries/__init__.py +0 -0
- office365/sharepoint/search/reports/topqueries/data.py +9 -0
- office365/sharepoint/search/reports/topqueries/item.py +15 -0
- office365/sharepoint/search/scs_endpoint.py +9 -0
- office365/sharepoint/securestore/target_application.py +8 -0
- office365/sharepoint/sharing/document_manager.py +3 -3
- office365/sharepoint/sharing/result.py +21 -0
- office365/sharepoint/sites/html_field_security_setting.py +5 -0
- office365/sharepoint/sites/site.py +30 -1
- office365/sharepoint/sites/version_policy_manager.py +25 -0
- office365/sharepoint/sitescripts/metadata.py +28 -3
- office365/sharepoint/sitescripts/utility.py +17 -0
- office365/sharepoint/smartcache/__init__.py +0 -0
- office365/sharepoint/smartcache/item.py +9 -0
- office365/sharepoint/tenant/administration/app_billing_properties.py +21 -0
- office365/sharepoint/tenant/administration/insights/summary_response.py +8 -0
- office365/sharepoint/tenant/administration/internal/aad/__init__.py +0 -0
- office365/sharepoint/tenant/administration/internal/aad/permission_grant.py +32 -0
- office365/sharepoint/tenant/administration/internal/appservice/__init__.py +0 -0
- office365/sharepoint/tenant/administration/internal/appservice/permission_grant.py +5 -0
- office365/sharepoint/tenant/administration/internal/{permission_grant.py → appservice/permission_request.py} +4 -2
- office365/sharepoint/tenant/administration/internal/appservice/principal.py +104 -0
- office365/sharepoint/tenant/administration/settings_service.py +4 -1
- office365/sharepoint/tenant/administration/sites/creation_source.py +8 -8
- office365/sharepoint/tenant/administration/tenant.py +110 -4
- office365/sharepoint/tenant/administration/types.py +13 -1
- office365/sharepoint/tenant/cdn_api.py +3 -1
- office365/sharepoint/tenant/management/office365_tenant.py +2 -0
- office365/sharepoint/tenant/settings.py +10 -0
- office365/sharepoint/utilities/utility.py +6 -0
- office365/sharepoint/viva/connections_page.py +8 -0
- office365/sharepoint/viva/dashboard_configuration.py +8 -0
- office365/sharepoint/viva/employee_engagement.py +39 -1
- office365/sharepoint/viva/resource_get_endpoint.py +8 -0
- office365/sharepoint/viva/resource_link.py +8 -0
- office365/sharepoint/webs/information.py +66 -1
- office365/sharepoint/webs/regional_settings.py +32 -0
- office365/sharepoint/webs/templates/__init__.py +0 -0
- office365/sharepoint/webs/time_zone.py +1 -1
- office365/sharepoint/webs/web.py +58 -0
- office365/sharepoint/workflow/task.py +5 -0
- office365/subscriptions/collection.py +16 -0
- office365/sharepoint/portal/userprofiles/documents_shared_with_group.py +0 -11
- office365/sharepoint/tenant/administration/internal/web_appservice_principal.py +0 -23
- {Office365_REST_Python_Client-2.5.13.dist-info → Office365_REST_Python_Client-2.5.14.dist-info}/LICENSE +0 -0
- {Office365_REST_Python_Client-2.5.13.dist-info → Office365_REST_Python_Client-2.5.14.dist-info}/WHEEL +0 -0
- {Office365_REST_Python_Client-2.5.13.dist-info → Office365_REST_Python_Client-2.5.14.dist-info}/top_level.txt +0 -0
- /office365/{sharepoint/userprofiles/sharedwithme → partners}/__init__.py +0 -0
- /office365/sharepoint/portal/userprofiles/{documents_shared_with_me.py → documentsshared/with_me.py} +0 -0
- /office365/sharepoint/{userprofiles → portal/userprofiles}/sharedwithme/document_user.py +0 -0
- /office365/sharepoint/{userprofiles → portal/userprofiles}/sharedwithme/item_collection.py +0 -0
- /office365/sharepoint/{userprofiles → portal/userprofiles}/sharedwithme/view_item_removal_result.py +0 -0
|
@@ -46,6 +46,19 @@ class BookingBusiness(Entity):
|
|
|
46
46
|
self.context.add_query(qry)
|
|
47
47
|
return return_type
|
|
48
48
|
|
|
49
|
+
def publish(self):
|
|
50
|
+
"""
|
|
51
|
+
Make the scheduling page of a business available to external customers.
|
|
52
|
+
|
|
53
|
+
Set the isPublished property to true, and the publicUrl property to the URL of the scheduling page.
|
|
54
|
+
"""
|
|
55
|
+
qry = ServiceOperationQuery(
|
|
56
|
+
self,
|
|
57
|
+
"publish",
|
|
58
|
+
)
|
|
59
|
+
self.context.add_query(qry)
|
|
60
|
+
return self
|
|
61
|
+
|
|
49
62
|
@property
|
|
50
63
|
def address(self):
|
|
51
64
|
"""
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.booking.business.business import BookingBusiness
|
|
2
4
|
from office365.entity_collection import EntityCollection
|
|
5
|
+
from office365.outlook.mail.physical_address import PhysicalAddress
|
|
3
6
|
|
|
4
7
|
|
|
5
8
|
class BookingBusinessCollection(EntityCollection[BookingBusiness]):
|
|
@@ -10,12 +13,13 @@ class BookingBusinessCollection(EntityCollection[BookingBusiness]):
|
|
|
10
13
|
context, BookingBusiness, resource_path
|
|
11
14
|
)
|
|
12
15
|
|
|
13
|
-
def add(self, display_name):
|
|
16
|
+
def add(self, display_name, address=None, email=None):
|
|
17
|
+
# type: (str, Optional[PhysicalAddress], Optional[str]) -> BookingBusiness
|
|
14
18
|
"""
|
|
15
19
|
Create a new Microsoft Bookings business in a tenant.
|
|
16
20
|
:param str display_name: The business display name.
|
|
21
|
+
:param PhysicalAddress address: The business display name.
|
|
22
|
+
:param str email: The email address for the business.
|
|
17
23
|
"""
|
|
18
|
-
props = {
|
|
19
|
-
"displayName": display_name,
|
|
20
|
-
}
|
|
24
|
+
props = {"displayName": display_name, "address": address, "email": email}
|
|
21
25
|
return super(BookingBusinessCollection, self).add(**props)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from datetime import datetime, timedelta
|
|
2
|
+
|
|
3
|
+
from office365.communications.callrecords.call_record import CallRecord
|
|
4
|
+
from office365.communications.callrecords.direct_routing_log_row import (
|
|
5
|
+
DirectRoutingLogRow,
|
|
6
|
+
)
|
|
7
|
+
from office365.entity_collection import EntityCollection
|
|
8
|
+
from office365.runtime.client_result import ClientResult
|
|
9
|
+
from office365.runtime.client_value_collection import ClientValueCollection
|
|
10
|
+
from office365.runtime.queries.function import FunctionQuery
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CallRecordCollection(EntityCollection[CallRecord]):
|
|
14
|
+
def __init__(self, context, resource_path=None):
|
|
15
|
+
super(CallRecordCollection, self).__init__(context, CallRecord, resource_path)
|
|
16
|
+
|
|
17
|
+
def get_direct_routing_calls(self, from_datetime=None, to_datetime=None):
|
|
18
|
+
"""
|
|
19
|
+
Get a log of direct routing calls as a collection of directRoutingLogRow entries.
|
|
20
|
+
:param datetime from_datetime: Start of time range to query.
|
|
21
|
+
:param datetime to_datetime: End of time range to query
|
|
22
|
+
"""
|
|
23
|
+
if to_datetime is None:
|
|
24
|
+
to_datetime = datetime.now()
|
|
25
|
+
|
|
26
|
+
if from_datetime is None:
|
|
27
|
+
from_datetime = to_datetime - timedelta(days=30)
|
|
28
|
+
|
|
29
|
+
return_type = ClientResult(
|
|
30
|
+
self.context, ClientValueCollection(DirectRoutingLogRow)
|
|
31
|
+
)
|
|
32
|
+
payload = {
|
|
33
|
+
"fromDateTime": from_datetime.strftime("%Y-%m-%d"),
|
|
34
|
+
"toDateTime": to_datetime.strftime("%Y-%m-%d"),
|
|
35
|
+
}
|
|
36
|
+
qry = FunctionQuery(self, "getDirectRoutingCalls", payload, return_type)
|
|
37
|
+
|
|
38
|
+
def _patch_request(request):
|
|
39
|
+
request.url = request.url.replace("'", "")
|
|
40
|
+
|
|
41
|
+
self.context.add_query(qry).before_query_execute(_patch_request)
|
|
42
|
+
return return_type
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from office365.communications.callrecords.
|
|
1
|
+
from office365.communications.callrecords.collection import CallRecordCollection
|
|
2
2
|
from office365.communications.calls.collection import CallCollection
|
|
3
3
|
from office365.communications.onlinemeetings.collection import OnlineMeetingCollection
|
|
4
4
|
from office365.communications.presences.presence import Presence
|
|
@@ -37,9 +37,8 @@ class CloudCommunications(Entity):
|
|
|
37
37
|
""" " """
|
|
38
38
|
return self.properties.get(
|
|
39
39
|
"callRecords",
|
|
40
|
-
|
|
40
|
+
CallRecordCollection(
|
|
41
41
|
self.context,
|
|
42
|
-
CallRecord,
|
|
43
42
|
ResourcePath("callRecords", self.resource_path),
|
|
44
43
|
),
|
|
45
44
|
)
|
|
@@ -5,6 +5,9 @@ from typing import Optional
|
|
|
5
5
|
from office365.directory.applications.api import ApiApplication
|
|
6
6
|
from office365.directory.applications.optional_claims import OptionalClaims
|
|
7
7
|
from office365.directory.applications.public_client import PublicClientApplication
|
|
8
|
+
from office365.directory.applications.required_resource_access import (
|
|
9
|
+
RequiredResourceAccess,
|
|
10
|
+
)
|
|
8
11
|
from office365.directory.applications.roles.role import AppRole
|
|
9
12
|
from office365.directory.applications.spa import SpaApplication
|
|
10
13
|
from office365.directory.certificates.certification import Certification
|
|
@@ -53,7 +56,7 @@ class Application(DirectoryObject):
|
|
|
53
56
|
:param datetime.datetime end_datetime: The date and time at which the credential expires. Default: now + 180days
|
|
54
57
|
"""
|
|
55
58
|
if start_datetime is None:
|
|
56
|
-
start_datetime = datetime.datetime.
|
|
59
|
+
start_datetime = datetime.datetime.now()
|
|
57
60
|
if end_datetime is None:
|
|
58
61
|
end_datetime = start_datetime + datetime.timedelta(days=180)
|
|
59
62
|
|
|
@@ -228,7 +231,7 @@ class Application(DirectoryObject):
|
|
|
228
231
|
@property
|
|
229
232
|
def key_credentials(self):
|
|
230
233
|
"""The collection of key credentials associated with the application. Not nullable."""
|
|
231
|
-
self.
|
|
234
|
+
self._properties_to_persist.append("keyCredentials")
|
|
232
235
|
return self.properties.setdefault(
|
|
233
236
|
"keyCredentials", ClientValueCollection(KeyCredential)
|
|
234
237
|
)
|
|
@@ -315,6 +318,16 @@ class Application(DirectoryObject):
|
|
|
315
318
|
),
|
|
316
319
|
)
|
|
317
320
|
|
|
321
|
+
@property
|
|
322
|
+
def required_resource_access(self):
|
|
323
|
+
"""Specifies the resources that the application needs to access. This property also specifies the set
|
|
324
|
+
of delegated permissions and application roles that it needs for each of those resources.
|
|
325
|
+
This configuration of access to the required resources drives the consent experience.
|
|
326
|
+
"""
|
|
327
|
+
return self.properties.get(
|
|
328
|
+
"requiredResourceAccess", ClientValueCollection(RequiredResourceAccess)
|
|
329
|
+
)
|
|
330
|
+
|
|
318
331
|
@property
|
|
319
332
|
def token_issuance_policies(self):
|
|
320
333
|
# type: () -> EntityCollection[TokenIssuancePolicy]
|
|
@@ -339,6 +352,7 @@ class Application(DirectoryObject):
|
|
|
339
352
|
"optionalClaims": self.optional_claims,
|
|
340
353
|
"passwordCredentials": self.password_credentials,
|
|
341
354
|
"publicClient": self.public_client,
|
|
355
|
+
"requiredResourceAccess": self.required_resource_access,
|
|
342
356
|
"tokenIssuancePolicies": self.token_issuance_policies,
|
|
343
357
|
}
|
|
344
358
|
default_value = property_mapping.get(name, None)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from office365.directory.applications.resource_access import ResourceAccess
|
|
2
|
+
from office365.runtime.client_value import ClientValue
|
|
3
|
+
from office365.runtime.client_value_collection import ClientValueCollection
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class RequiredResourceAccess(ClientValue):
|
|
7
|
+
"""Specifies the set of OAuth 2.0 permission scopes and app roles under the specified resource that an
|
|
8
|
+
application requires access to. The application may request the specified OAuth 2.0 permission scopes or app
|
|
9
|
+
roles through the requiredResourceAccess property, which is a collection of requiredResourceAccess objects.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __init__(self, resource_access=None, resource_app_id=None):
|
|
13
|
+
"""
|
|
14
|
+
:param list[ResourceAccess] resource_access: The list of OAuth2.0 permission scopes and app roles that
|
|
15
|
+
the application requires from the specified resource.
|
|
16
|
+
:param str resource_app_id: The unique identifier for the resource that the application requires access to.
|
|
17
|
+
This should be equal to the appId declared on the target resource application.
|
|
18
|
+
"""
|
|
19
|
+
self.resourceAccess = ClientValueCollection(ResourceAccess, resource_access)
|
|
20
|
+
self.resourceAppId = resource_app_id
|
|
21
|
+
|
|
22
|
+
def __repr__(self):
|
|
23
|
+
return self.resourceAppId or self.entity_type_name
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from office365.runtime.client_value import ClientValue
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ResourceAccess(ClientValue):
|
|
5
|
+
"""Object used to specify an OAuth 2.0 permission scope or an app role that an application requires,
|
|
6
|
+
through the resourceAccess property of the requiredResourceAccess resource type."""
|
|
7
|
+
|
|
8
|
+
def __init__(self, id_=None, type_=None):
|
|
9
|
+
"""
|
|
10
|
+
:param str id_: The unique identifier of an app role or delegated permission exposed by the resource
|
|
11
|
+
application. For delegated permissions, this should match the id property of one of the delegated
|
|
12
|
+
permissions in the oauth2PermissionScopes collection of the resource application's service principal.
|
|
13
|
+
For app roles (application permissions), this should match the id property of an app role in the appRoles
|
|
14
|
+
collection of the resource application's service principal.
|
|
15
|
+
:param str type_: Specifies whether the id property references a delegated permission or an app role
|
|
16
|
+
(application permission). The possible values are: Scope (for delegated permissions) or Role (for app roles).
|
|
17
|
+
"""
|
|
18
|
+
self.id = id_
|
|
19
|
+
self.type = type_
|
|
20
|
+
|
|
21
|
+
def __repr__(self):
|
|
22
|
+
return "ResourceAccess(id={!r}, type={!r})".format(self.id, self.type)
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
def type_name(self):
|
|
26
|
+
return "Delegated" if self.type == "Scope" else "Application"
|
|
@@ -54,6 +54,32 @@ class UserRegistrationDetails(Entity):
|
|
|
54
54
|
"""
|
|
55
55
|
return self.properties.get("isSsprEnabled", None)
|
|
56
56
|
|
|
57
|
+
@property
|
|
58
|
+
def user_display_name(self):
|
|
59
|
+
# type: () -> Optional[str]
|
|
60
|
+
"""
|
|
61
|
+
The user display name, such as Adele Vance. Supports $filter (eq, startsWith) and $orderby.
|
|
62
|
+
"""
|
|
63
|
+
return self.properties.get("userDisplayName", None)
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def user_preferred_method_for_secondary_authentication(self):
|
|
67
|
+
# type: () -> Optional[str]
|
|
68
|
+
"""
|
|
69
|
+
The method the user selected as the default second-factor for performing multifactor authentication.
|
|
70
|
+
"""
|
|
71
|
+
return self.properties.get(
|
|
72
|
+
"userPreferredMethodForSecondaryAuthentication", None
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def user_principal_name(self):
|
|
77
|
+
# type: () -> Optional[str]
|
|
78
|
+
"""
|
|
79
|
+
The user principal name, such as AdeleV@contoso.com. Supports $filter (eq, startsWith) and $orderby.
|
|
80
|
+
"""
|
|
81
|
+
return self.properties.get("userPrincipalName", None)
|
|
82
|
+
|
|
57
83
|
@property
|
|
58
84
|
def user_type(self):
|
|
59
85
|
# type: () -> Optional[str]
|
|
@@ -62,3 +88,6 @@ class UserRegistrationDetails(Entity):
|
|
|
62
88
|
The possible values are: member, guest, unknownFutureValue.
|
|
63
89
|
"""
|
|
64
90
|
return self.properties.get("userType", None)
|
|
91
|
+
|
|
92
|
+
def __repr__(self):
|
|
93
|
+
return self.user_principal_name or self.id or self.entity_type_name
|
|
@@ -32,3 +32,11 @@ class AuthenticationMethodsRoot(Entity):
|
|
|
32
32
|
ResourcePath("userRegistrationDetails", self.resource_path),
|
|
33
33
|
),
|
|
34
34
|
)
|
|
35
|
+
|
|
36
|
+
def get_property(self, name, default_value=None):
|
|
37
|
+
if default_value is None:
|
|
38
|
+
property_mapping = {
|
|
39
|
+
"userRegistrationDetails": self.user_registration_details
|
|
40
|
+
}
|
|
41
|
+
default_value = property_mapping.get(name, None)
|
|
42
|
+
return super(AuthenticationMethodsRoot, self).get_property(name, default_value)
|
|
@@ -15,8 +15,13 @@ class PermissionScope(ClientValue):
|
|
|
15
15
|
self,
|
|
16
16
|
admin_consent_display_name=None,
|
|
17
17
|
admin_consent_description=None,
|
|
18
|
-
|
|
18
|
+
id_=None,
|
|
19
19
|
is_enabled=None,
|
|
20
|
+
origin=None,
|
|
21
|
+
type_=None,
|
|
22
|
+
user_consent_description=None,
|
|
23
|
+
user_consent_display_name=None,
|
|
24
|
+
value=None,
|
|
20
25
|
):
|
|
21
26
|
"""
|
|
22
27
|
:param str admin_consent_display_name: The permission's title, intended to be read by an administrator granting
|
|
@@ -24,13 +29,20 @@ class PermissionScope(ClientValue):
|
|
|
24
29
|
:param str admin_consent_description: A description of the delegated permissions, intended to be read
|
|
25
30
|
by an administrator granting the permission on behalf of all users. This text appears in tenant-wide
|
|
26
31
|
admin consent experiences.
|
|
27
|
-
:param str
|
|
32
|
+
:param str id_: Unique delegated permission identifier inside the collection of delegated permissions defined
|
|
28
33
|
for a resource application.
|
|
29
34
|
:param str is_enabled: When creating or updating a permission, this property must be set to true
|
|
30
35
|
(which is the default). To delete a permission, this property must first be set to false.
|
|
31
36
|
At that point, in a subsequent call, the permission may be removed.
|
|
37
|
+
|
|
38
|
+
:param str value: Specifies the value to include in the scp (scope) claim in access tokens.
|
|
32
39
|
"""
|
|
33
40
|
self.adminConsentDescription = admin_consent_description
|
|
34
41
|
self.adminConsentDisplayName = admin_consent_display_name
|
|
35
|
-
self.id =
|
|
42
|
+
self.id = id_
|
|
36
43
|
self.isEnabled = is_enabled
|
|
44
|
+
self.origin = origin
|
|
45
|
+
self.type = type_
|
|
46
|
+
self.userConsentDescription = user_consent_description
|
|
47
|
+
self.userConsentDisplayName = user_consent_display_name
|
|
48
|
+
self.value = value
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
from office365.directory.authentication.strength_usage import (
|
|
2
2
|
AuthenticationStrengthUsage,
|
|
3
3
|
)
|
|
4
|
+
from office365.directory.policies.update_allowed_combinations_result import (
|
|
5
|
+
UpdateAllowedCombinationsResult,
|
|
6
|
+
)
|
|
4
7
|
from office365.entity import Entity
|
|
5
8
|
from office365.runtime.client_result import ClientResult
|
|
6
9
|
from office365.runtime.queries.function import FunctionQuery
|
|
10
|
+
from office365.runtime.queries.service_operation import ServiceOperationQuery
|
|
7
11
|
|
|
8
12
|
|
|
9
13
|
class AuthenticationStrengthPolicy(Entity):
|
|
@@ -26,3 +30,20 @@ class AuthenticationStrengthPolicy(Entity):
|
|
|
26
30
|
qry = FunctionQuery(self, "usage", None, return_type)
|
|
27
31
|
self.context.add_query(qry)
|
|
28
32
|
return return_type
|
|
33
|
+
|
|
34
|
+
def update_allowed_combinations(self, allowed_combinations=None):
|
|
35
|
+
"""
|
|
36
|
+
Update the allowedCombinations property of an authenticationStrengthPolicy object.
|
|
37
|
+
To update other properties of an authenticationStrengthPolicy object,
|
|
38
|
+
use the Update authenticationStrengthPolicy method.
|
|
39
|
+
|
|
40
|
+
:param list[str] allowed_combinations: The authentication method combinations allowed by this authentication
|
|
41
|
+
strength policy.
|
|
42
|
+
"""
|
|
43
|
+
return_type = ClientResult(self.context, UpdateAllowedCombinationsResult())
|
|
44
|
+
payload = {"allowedCombinations": allowed_combinations}
|
|
45
|
+
qry = ServiceOperationQuery(
|
|
46
|
+
self, "updateAllowedCombinations", None, payload, None, return_type
|
|
47
|
+
)
|
|
48
|
+
self.context.add_query(qry)
|
|
49
|
+
return return_type
|
|
@@ -3,7 +3,8 @@ from office365.runtime.types.collections import StringCollection
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class AlertEvidence(ClientValue):
|
|
6
|
-
"""
|
|
6
|
+
"""The alertEvidence base type and its derived evidence types provide a means to organize and track rich data
|
|
7
|
+
about each artifact involved in an alert."""
|
|
7
8
|
|
|
8
9
|
def __init__(self, created_datetime=None, detailed_roles=None):
|
|
9
10
|
"""
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
from office365.directory.security.attacksimulations.user import AttackSimulationUser
|
|
1
2
|
from office365.runtime.client_value import ClientValue
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
class UserSimulationDetails(ClientValue):
|
|
5
6
|
"""Represents a user of a tenant and their online actions in an attack simulation and training campaign."""
|
|
6
7
|
|
|
7
|
-
def __init__(
|
|
8
|
+
def __init__(
|
|
9
|
+
self, assigned_trainings_count=None, simulation_user=AttackSimulationUser()
|
|
10
|
+
):
|
|
8
11
|
"""
|
|
9
12
|
:param int assigned_trainings_count: Number of trainings assigned to a user in an attack simulation
|
|
10
13
|
and training campaign.
|
|
14
|
+
:param AttackSimulationUser simulation_user:
|
|
11
15
|
"""
|
|
12
16
|
self.assignedTrainingsCount = assigned_trainings_count
|
|
17
|
+
self.simulationUser = simulation_user
|
|
@@ -114,55 +114,63 @@ class ServicePrincipal(DirectoryObject):
|
|
|
114
114
|
else:
|
|
115
115
|
self.context.service_principals.get_by_app(app).get().after_execute(action)
|
|
116
116
|
|
|
117
|
-
def
|
|
118
|
-
# type: (Application|str, User|str
|
|
119
|
-
"""Gets a delegated permission
|
|
117
|
+
def get_delegated_permissions(self, app, principal=None):
|
|
118
|
+
# type: (Application|str, User|str) -> ClientResult[StringCollection]
|
|
119
|
+
"""Gets a delegated API permission"""
|
|
120
120
|
|
|
121
|
-
return_type =
|
|
121
|
+
return_type = ClientResult(self.context, StringCollection())
|
|
122
122
|
|
|
123
|
-
def
|
|
124
|
-
# type: (
|
|
125
|
-
if scope is None:
|
|
126
|
-
[return_type.add_child(g) for g in col if g.resource_id == self.id]
|
|
127
|
-
else:
|
|
128
|
-
[
|
|
129
|
-
return_type.add_child(g)
|
|
130
|
-
for g in col
|
|
131
|
-
if g.scope == scope and g.resource_id == self.id
|
|
132
|
-
]
|
|
123
|
+
def _get_delegated_permissions(client_id, principal_id=None):
|
|
124
|
+
# type: (str, str) -> None
|
|
133
125
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
126
|
+
if principal_id is None:
|
|
127
|
+
query_text = (
|
|
128
|
+
"clientId eq '{0}' and consentType eq 'AllPrincipals'".format(
|
|
129
|
+
client_id
|
|
130
|
+
)
|
|
131
|
+
)
|
|
132
|
+
else:
|
|
133
|
+
query_text = "principalId eq '{0}' and clientId eq '{1}'".format(
|
|
134
|
+
principal_id, client_id
|
|
140
135
|
)
|
|
141
136
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
.
|
|
145
|
-
.after_execute(_get_delegated)
|
|
137
|
+
def _loaded(col):
|
|
138
|
+
scope_val = next(
|
|
139
|
+
iter([g.scope for g in col if g.resource_id == self.id]), None
|
|
146
140
|
)
|
|
141
|
+
if scope_val is not None:
|
|
142
|
+
[return_type.value.add(name) for name in scope_val.split(" ")]
|
|
147
143
|
|
|
148
|
-
|
|
149
|
-
|
|
144
|
+
(
|
|
145
|
+
self.context.oauth2_permission_grants.get()
|
|
146
|
+
.filter(query_text)
|
|
147
|
+
.after_execute(_loaded)
|
|
150
148
|
)
|
|
151
149
|
|
|
152
|
-
def
|
|
150
|
+
def _resolve_application():
|
|
151
|
+
# type: () -> None
|
|
152
|
+
def _after(service_principal):
|
|
153
|
+
if principal is None:
|
|
154
|
+
_get_delegated_permissions(service_principal.id)
|
|
155
|
+
else:
|
|
156
|
+
_resolve_principal(service_principal.id)
|
|
157
|
+
|
|
158
|
+
self.context.service_principals.get_by_app(app).get().after_execute(_after)
|
|
159
|
+
|
|
160
|
+
def _resolve_principal(app_id):
|
|
153
161
|
if isinstance(principal, User):
|
|
154
162
|
|
|
155
163
|
def _after():
|
|
156
|
-
|
|
164
|
+
_get_delegated_permissions(app_id, principal.id)
|
|
157
165
|
|
|
158
166
|
principal.ensure_property("id", _after)
|
|
159
167
|
else:
|
|
160
|
-
|
|
168
|
+
_get_delegated_permissions(app_id, principal)
|
|
161
169
|
|
|
162
|
-
self.ensure_property("id",
|
|
170
|
+
self.ensure_property("id", _resolve_application)
|
|
163
171
|
return return_type
|
|
164
172
|
|
|
165
|
-
def
|
|
173
|
+
def grant_delegated_permissions(self, app, principal, scope):
|
|
166
174
|
# type: (Application|str, User|str, AppRole|str) -> Self
|
|
167
175
|
"""Grants a delegated permission to the client service principal on behalf of a user"""
|
|
168
176
|
|
|
@@ -198,11 +206,11 @@ class ServicePrincipal(DirectoryObject):
|
|
|
198
206
|
self.ensure_property("id", _resource_resolved)
|
|
199
207
|
return self
|
|
200
208
|
|
|
201
|
-
def
|
|
209
|
+
def revoke_delegated_permissions(self, app, principal, scope):
|
|
202
210
|
# type: (Application|str, User|str, AppRole|str) -> Self
|
|
203
211
|
""""""
|
|
204
212
|
|
|
205
|
-
def
|
|
213
|
+
def _revoke_delegated_permissions(app_id, principal_id):
|
|
206
214
|
# type: (str, str) -> None
|
|
207
215
|
|
|
208
216
|
def _after(return_type):
|
|
@@ -219,16 +227,40 @@ class ServicePrincipal(DirectoryObject):
|
|
|
219
227
|
if isinstance(principal, User):
|
|
220
228
|
|
|
221
229
|
def _after():
|
|
222
|
-
|
|
230
|
+
_revoke_delegated_permissions(principal.id, return_type.id)
|
|
223
231
|
|
|
224
232
|
principal.ensure_property("id", _after)
|
|
225
233
|
else:
|
|
226
|
-
|
|
234
|
+
_revoke_delegated_permissions(principal, return_type.id)
|
|
227
235
|
|
|
228
236
|
self._get_service_principal_by_app(app, _ensure_principal)
|
|
229
237
|
return self
|
|
230
238
|
|
|
231
|
-
def
|
|
239
|
+
def get_application_permissions(self, app):
|
|
240
|
+
# type: (Application|str) -> ClientResult[AppRoleCollection]
|
|
241
|
+
return_type = ClientResult(self.context, AppRoleCollection())
|
|
242
|
+
|
|
243
|
+
def _get_application_permissions(app_id):
|
|
244
|
+
app_role_ids = [
|
|
245
|
+
app_role.app_role_id
|
|
246
|
+
for app_role in self.app_role_assigned_to
|
|
247
|
+
if app_role.principal_id == app_id
|
|
248
|
+
]
|
|
249
|
+
for app_role in self.app_roles:
|
|
250
|
+
if app_role.id in app_role_ids:
|
|
251
|
+
return_type.value.add(app_role)
|
|
252
|
+
|
|
253
|
+
def _resolve_app():
|
|
254
|
+
|
|
255
|
+
def _after(service_principal):
|
|
256
|
+
_get_application_permissions(service_principal.id)
|
|
257
|
+
|
|
258
|
+
self.context.service_principals.get_by_app(app).get().after_execute(_after)
|
|
259
|
+
|
|
260
|
+
self.ensure_properties(["id", "appRoles", "appRoleAssignedTo"], _resolve_app)
|
|
261
|
+
return return_type
|
|
262
|
+
|
|
263
|
+
def grant_application_permissions(self, app, app_role):
|
|
232
264
|
# type: (Application|str, AppRole|str) -> Self
|
|
233
265
|
"""
|
|
234
266
|
Grants an app role assignment to a client service principal
|
|
@@ -254,7 +286,7 @@ class ServicePrincipal(DirectoryObject):
|
|
|
254
286
|
self.ensure_properties(["id", "appRoles"], _ensure_resource)
|
|
255
287
|
return self
|
|
256
288
|
|
|
257
|
-
def
|
|
289
|
+
def revoke_application_permissions(self, app, app_role):
|
|
258
290
|
# type: (Application|str, AppRole|str) -> Self
|
|
259
291
|
"""Revokes an app role assignment from a client service principal"""
|
|
260
292
|
|
|
@@ -326,6 +358,12 @@ class ServicePrincipal(DirectoryObject):
|
|
|
326
358
|
"""The display name exposed by the associated application."""
|
|
327
359
|
return self.properties.get("appDisplayName", None)
|
|
328
360
|
|
|
361
|
+
@property
|
|
362
|
+
def app_id(self):
|
|
363
|
+
# type: () -> Optional[str]
|
|
364
|
+
"""The unique identifier for the associated application (its appId property)."""
|
|
365
|
+
return self.properties.get("appId", None)
|
|
366
|
+
|
|
329
367
|
@property
|
|
330
368
|
def app_role_assigned_to(self):
|
|
331
369
|
"""
|
|
@@ -338,6 +376,16 @@ class ServicePrincipal(DirectoryObject):
|
|
|
338
376
|
),
|
|
339
377
|
)
|
|
340
378
|
|
|
379
|
+
@property
|
|
380
|
+
def app_role_assignments(self):
|
|
381
|
+
"""Get an event collection or an appRoleAssignments."""
|
|
382
|
+
return self.properties.get(
|
|
383
|
+
"appRoleAssignments",
|
|
384
|
+
AppRoleAssignmentCollection(
|
|
385
|
+
self.context, ResourcePath("appRoleAssignments", self.resource_path)
|
|
386
|
+
),
|
|
387
|
+
)
|
|
388
|
+
|
|
341
389
|
@property
|
|
342
390
|
def app_roles(self):
|
|
343
391
|
"""The roles exposed by the application which this service principal represents."""
|
|
@@ -503,6 +551,7 @@ class ServicePrincipal(DirectoryObject):
|
|
|
503
551
|
property_mapping = {
|
|
504
552
|
"appRoles": self.app_roles,
|
|
505
553
|
"appRoleAssignedTo": self.app_role_assigned_to,
|
|
554
|
+
"appRoleAssignments": self.app_role_assignments,
|
|
506
555
|
"created_objects": self.created_objects,
|
|
507
556
|
"keyCredentials": self.key_credentials,
|
|
508
557
|
"oauth2PermissionScopes": self.oauth2_permission_scopes,
|
|
@@ -366,7 +366,7 @@ class DriveItem(BaseItem):
|
|
|
366
366
|
def download_folder(
|
|
367
367
|
self, download_file, after_file_downloaded=None, recursive=True
|
|
368
368
|
):
|
|
369
|
-
# type: (IO, Callable[[
|
|
369
|
+
# type: (IO, Callable[["DriveItem"], None], bool) -> "DriveItem"
|
|
370
370
|
"""
|
|
371
371
|
Download the folder content
|
|
372
372
|
"""
|