Office365-REST-Python-Client 2.5.11__py3-none-any.whl → 2.5.13__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.11.dist-info → Office365_REST_Python_Client-2.5.13.dist-info}/METADATA +6 -1
- {Office365_REST_Python_Client-2.5.11.dist-info → Office365_REST_Python_Client-2.5.13.dist-info}/RECORD +108 -66
- office365/backuprestore/__init__.py +0 -0
- office365/backuprestore/root.py +39 -0
- office365/backuprestore/service_status.py +5 -0
- office365/booking/solutions/root.py +14 -1
- office365/directory/applications/application.py +17 -0
- office365/directory/applications/optional_claim.py +5 -0
- office365/directory/applications/optional_claims.py +16 -0
- office365/directory/authentication/conditions/__init__.py +0 -0
- office365/directory/authentication/conditions/application.py +5 -0
- office365/directory/authentication/conditions/applications.py +5 -0
- office365/directory/authentication/conditions/conditions.py +11 -0
- office365/directory/authentication/conditions/event_listener.py +9 -0
- office365/directory/device_local_credential_info.py +21 -0
- office365/directory/identities/container.py +18 -0
- office365/directory/policies/authentication_flows.py +8 -0
- office365/directory/policies/root.py +17 -0
- office365/directory/policies/unified_role_management.py +7 -0
- office365/directory/protection/policy/__init__.py +0 -0
- office365/directory/protection/policy/base.py +24 -0
- office365/directory/protection/policy/one_drive_for_business.py +10 -0
- office365/directory/security/attacksimulations/users/details.py +7 -0
- office365/directory/serviceprincipals/service_principal.py +65 -14
- office365/directory/users/user.py +23 -3
- office365/graph_client.py +6 -1
- office365/intune/devices/management/management.py +26 -0
- office365/intune/devices/management/terms_and_conditions.py +10 -0
- office365/intune/devices/management/virtual_endpoint.py +8 -0
- office365/onedrive/idle_session_signout.py +15 -0
- office365/onedrive/sharepoint_settings.py +13 -0
- office365/onedrive/sitepages/title_area.py +15 -5
- office365/outlook/calendar/sharing/__init__.py +0 -0
- office365/outlook/calendar/sharing/message_action.py +5 -0
- office365/outlook/calendar/sharing_message.py +19 -0
- office365/outlook/calendar/timezones/custom.py +9 -0
- office365/outlook/mail/automatic_replies_setting.py +7 -0
- office365/outlook/mail/messages/rules/predicates.py +5 -0
- office365/outlook/mail/messages/rules/rule.py +4 -3
- office365/runtime/client_object.py +9 -1
- office365/runtime/client_object_collection.py +2 -2
- office365/runtime/client_result.py +19 -2
- office365/runtime/odata/query_options.py +3 -0
- office365/runtime/odata/v4/batch_request.py +12 -15
- office365/runtime/queries/batch.py +4 -0
- office365/sharepoint/appprincipal/identity_provider.py +7 -1
- office365/sharepoint/apps/context_site.py +41 -0
- office365/sharepoint/authpolicy/events/collection.py +11 -0
- office365/sharepoint/authpolicy/events/{auth_event.py → event.py} +1 -0
- office365/sharepoint/authpolicy/events/role_assignment_resource_payload.py +5 -0
- office365/sharepoint/brandcenter/__init__.py +0 -0
- office365/sharepoint/brandcenter/brand_center.py +9 -0
- office365/sharepoint/brandcenter/configuration.py +5 -0
- office365/sharepoint/changes/change.py +1 -3
- office365/sharepoint/changes/collection.py +3 -0
- office365/sharepoint/changes/folder.py +6 -0
- office365/sharepoint/changes/group.py +3 -0
- office365/sharepoint/changes/list.py +13 -0
- office365/sharepoint/changes/view.py +25 -0
- office365/sharepoint/client_context.py +23 -4
- office365/sharepoint/contenttypes/fieldlinks/collection.py +3 -0
- office365/sharepoint/copilot/__init__.py +0 -0
- office365/sharepoint/copilot/file_collection.py +27 -0
- office365/sharepoint/copilot/file_collection_query_result.py +10 -0
- office365/sharepoint/copilot/list_item_extensions.py +5 -0
- office365/sharepoint/directory/group.py +9 -9
- office365/sharepoint/directory/helper.py +6 -4
- office365/sharepoint/directory/provider/alternate_id_data.py +5 -0
- office365/sharepoint/directory/provider/notification.py +8 -0
- office365/sharepoint/directory/provider/object_changes.py +5 -0
- office365/sharepoint/directory/provider/object_data.py +26 -3
- office365/sharepoint/directory/provider/provider.py +1 -0
- office365/sharepoint/directory/provider/session_data.py +9 -0
- office365/sharepoint/entity.py +4 -3
- office365/sharepoint/lists/list.py +64 -1
- office365/sharepoint/logger/log_export.py +2 -0
- office365/sharepoint/migrationcenter/service/performance/data.py +5 -5
- office365/sharepoint/multigeo/services.py +24 -0
- office365/sharepoint/navigation/menu_node.py +43 -1
- office365/sharepoint/navigation/node_collection.py +1 -1
- office365/sharepoint/oauth/token.py +22 -0
- office365/sharepoint/oauth/token_response.py +5 -0
- office365/sharepoint/publishing/pages/campaign_publication.py +10 -0
- office365/sharepoint/publishing/pages/collection.py +1 -1
- office365/sharepoint/securestore/target_application.py +2 -0
- office365/sharepoint/sharing/inherited_from.py +5 -0
- office365/sharepoint/sharing/internal/__init__.py +0 -0
- office365/sharepoint/sharing/internal/sharing_restrictions.py +22 -0
- office365/sharepoint/sharing/internal/types.py +17 -0
- office365/sharepoint/sharing/link_info.py +24 -0
- office365/sharepoint/sites/site.py +9 -0
- office365/sharepoint/sites/version_policy_manager.py +8 -0
- office365/sharepoint/tenant/administration/policies/__init__.py +0 -0
- office365/sharepoint/tenant/administration/policies/definition.py +5 -0
- office365/sharepoint/tenant/administration/recent_admin_action_report.py +2 -2
- office365/sharepoint/tenant/administration/settings_service.py +9 -1
- office365/sharepoint/tenant/administration/sites/properties.py +45 -0
- office365/sharepoint/tenant/administration/tenant.py +44 -6
- office365/sharepoint/tenant/administration/types.py +17 -1
- office365/sharepoint/utilities/wopi_host.py +45 -0
- office365/sharepoint/webs/regional_settings.py +6 -0
- office365/sharepoint/webs/web.py +56 -0
- office365/sharepoint/workflow/definition.py +5 -0
- office365/sharepoint/workflowservices/deployment_service.py +23 -0
- office365/teams/members/settings.py +2 -2
- {Office365_REST_Python_Client-2.5.11.dist-info → Office365_REST_Python_Client-2.5.13.dist-info}/LICENSE +0 -0
- {Office365_REST_Python_Client-2.5.11.dist-info → Office365_REST_Python_Client-2.5.13.dist-info}/WHEEL +0 -0
- {Office365_REST_Python_Client-2.5.11.dist-info → Office365_REST_Python_Client-2.5.13.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from office365.backuprestore.service_status import ServiceStatus
|
|
2
|
+
from office365.directory.protection.policy.one_drive_for_business import (
|
|
3
|
+
OneDriveForBusinessProtectionPolicy,
|
|
4
|
+
)
|
|
5
|
+
from office365.entity import Entity
|
|
6
|
+
from office365.entity_collection import EntityCollection
|
|
7
|
+
from office365.runtime.paths.resource_path import ResourcePath
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BackupRestoreRoot(Entity):
|
|
11
|
+
"""Represents the Microsoft 365 Backup Storage service in a tenant."""
|
|
12
|
+
|
|
13
|
+
@property
|
|
14
|
+
def service_status(self):
|
|
15
|
+
"""Represents the tenant-level status of the Backup Storage service."""
|
|
16
|
+
return self.properties.get("serviceStatus", ServiceStatus())
|
|
17
|
+
|
|
18
|
+
@property
|
|
19
|
+
def one_drive_for_business_protection_policies(self):
|
|
20
|
+
"""The list of OneDrive for Business restore sessions available in the tenant."""
|
|
21
|
+
return self.properties.get(
|
|
22
|
+
"oneDriveForBusinessProtectionPolicies",
|
|
23
|
+
EntityCollection(
|
|
24
|
+
self.context,
|
|
25
|
+
OneDriveForBusinessProtectionPolicy,
|
|
26
|
+
ResourcePath(
|
|
27
|
+
"oneDriveForBusinessProtectionPolicies", self.resource_path
|
|
28
|
+
),
|
|
29
|
+
),
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
def get_property(self, name, default_value=None):
|
|
33
|
+
if default_value is None:
|
|
34
|
+
property_mapping = {
|
|
35
|
+
"serviceStatus": self.service_status,
|
|
36
|
+
"oneDriveForBusinessProtectionPolicies": self.one_drive_for_business_protection_policies,
|
|
37
|
+
}
|
|
38
|
+
default_value = property_mapping.get(name, None)
|
|
39
|
+
return super(BackupRestoreRoot, self).get_property(name, default_value)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from office365.backuprestore.root import BackupRestoreRoot
|
|
1
2
|
from office365.booking.business.collection import BookingBusinessCollection
|
|
2
3
|
from office365.booking.currency import BookingCurrency
|
|
3
4
|
from office365.entity import Entity
|
|
@@ -6,7 +7,7 @@ from office365.runtime.paths.resource_path import ResourcePath
|
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class SolutionsRoot(Entity):
|
|
9
|
-
""""""
|
|
10
|
+
"""The entry point for Microsoft Bookings, virtual event, and business scenario APIs."""
|
|
10
11
|
|
|
11
12
|
@property
|
|
12
13
|
def booking_businesses(self):
|
|
@@ -31,11 +32,23 @@ class SolutionsRoot(Entity):
|
|
|
31
32
|
),
|
|
32
33
|
)
|
|
33
34
|
|
|
35
|
+
@property
|
|
36
|
+
def backup_restore(self):
|
|
37
|
+
# type: () -> BackupRestoreRoot
|
|
38
|
+
"""Get a Microsoft 365 Backup Storage service in a tenant"""
|
|
39
|
+
return self.properties.get(
|
|
40
|
+
"backupRestore",
|
|
41
|
+
BackupRestoreRoot(
|
|
42
|
+
self.context, ResourcePath("backupRestore", self.resource_path)
|
|
43
|
+
),
|
|
44
|
+
)
|
|
45
|
+
|
|
34
46
|
def get_property(self, name, default_value=None):
|
|
35
47
|
if default_value is None:
|
|
36
48
|
property_mapping = {
|
|
37
49
|
"bookingBusinesses": self.booking_businesses,
|
|
38
50
|
"bookingCurrencies": self.booking_currencies,
|
|
51
|
+
"backupRestore": self.backup_restore,
|
|
39
52
|
}
|
|
40
53
|
default_value = property_mapping.get(name, None)
|
|
41
54
|
return super(SolutionsRoot, self).get_property(name, default_value)
|
|
@@ -3,6 +3,7 @@ import datetime
|
|
|
3
3
|
from typing import Optional
|
|
4
4
|
|
|
5
5
|
from office365.directory.applications.api import ApiApplication
|
|
6
|
+
from office365.directory.applications.optional_claims import OptionalClaims
|
|
6
7
|
from office365.directory.applications.public_client import PublicClientApplication
|
|
7
8
|
from office365.directory.applications.roles.role import AppRole
|
|
8
9
|
from office365.directory.applications.spa import SpaApplication
|
|
@@ -250,6 +251,20 @@ class Application(DirectoryObject):
|
|
|
250
251
|
"""
|
|
251
252
|
return self.properties.get("identifierUris", StringCollection())
|
|
252
253
|
|
|
254
|
+
@property
|
|
255
|
+
def optional_claims(self):
|
|
256
|
+
"""Application developers can configure optional claims in their Microsoft Entra applications to specify
|
|
257
|
+
the claims that are sent to their application by the Microsoft security token service.
|
|
258
|
+
"""
|
|
259
|
+
return self.properties.get("optionalClaims", OptionalClaims())
|
|
260
|
+
|
|
261
|
+
@property
|
|
262
|
+
def password_credentials(self):
|
|
263
|
+
"""The collection of password credentials associated with the application"""
|
|
264
|
+
return self.properties.get(
|
|
265
|
+
"passwordCredentials", ClientValueCollection(PasswordCredential)
|
|
266
|
+
)
|
|
267
|
+
|
|
253
268
|
@property
|
|
254
269
|
def public_client(self):
|
|
255
270
|
"""Specifies settings for installed clients such as desktop or mobile devices."""
|
|
@@ -321,6 +336,8 @@ class Application(DirectoryObject):
|
|
|
321
336
|
"createdOnBehalfOf": self.created_on_behalf_of,
|
|
322
337
|
"extensionProperties": self.extension_properties,
|
|
323
338
|
"keyCredentials": self.key_credentials,
|
|
339
|
+
"optionalClaims": self.optional_claims,
|
|
340
|
+
"passwordCredentials": self.password_credentials,
|
|
324
341
|
"publicClient": self.public_client,
|
|
325
342
|
"tokenIssuancePolicies": self.token_issuance_policies,
|
|
326
343
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from office365.directory.applications.optional_claim import OptionalClaim
|
|
2
|
+
from office365.runtime.client_value import ClientValue
|
|
3
|
+
from office365.runtime.client_value_collection import ClientValueCollection
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class OptionalClaims(ClientValue):
|
|
7
|
+
"""An application can configure optional claims to be returned in each of three types of tokens
|
|
8
|
+
(ID token, access token, SAML 2 token) it can receive from the security token service.
|
|
9
|
+
An application can configure a different set of optional claims to be returned in each token type.
|
|
10
|
+
The optionalClaims property of the application is an optionalClaims object."""
|
|
11
|
+
|
|
12
|
+
def __init__(self, access_token=None, id_token=None, saml2_token=None):
|
|
13
|
+
""" """
|
|
14
|
+
self.accessToken = ClientValueCollection(OptionalClaim, access_token)
|
|
15
|
+
self.idToken = ClientValueCollection(OptionalClaim, id_token)
|
|
16
|
+
self.saml2Token = ClientValueCollection(OptionalClaim, saml2_token)
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from office365.directory.authentication.conditions.applications import (
|
|
2
|
+
AuthenticationConditionsApplications,
|
|
3
|
+
)
|
|
4
|
+
from office365.runtime.client_value import ClientValue
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AuthenticationConditions(ClientValue):
|
|
8
|
+
""""""
|
|
9
|
+
|
|
10
|
+
def __init__(self, applications=AuthenticationConditionsApplications()):
|
|
11
|
+
self.applications = applications
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from office365.entity import Entity
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AuthenticationEventListener(Entity):
|
|
5
|
+
"""
|
|
6
|
+
Defines a listener to evaluate when an authentication event happens in an authentication experience.
|
|
7
|
+
An authenticationListener is abstract and is the base class of the various types of listeners you can evaluate
|
|
8
|
+
during an authentication event.
|
|
9
|
+
"""
|
|
@@ -1,6 +1,27 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
1
4
|
from office365.entity import Entity
|
|
2
5
|
|
|
3
6
|
|
|
4
7
|
class DeviceLocalCredentialInfo(Entity):
|
|
5
8
|
"""Represents local administrator credential information for all device objects in Azure Active Directory
|
|
6
9
|
that are enabled with Local Admin Password Solution (LAPS)."""
|
|
10
|
+
|
|
11
|
+
@property
|
|
12
|
+
def device_name(self):
|
|
13
|
+
# type: () -> Optional[str]
|
|
14
|
+
"""
|
|
15
|
+
Display name of the device that the local credentials are associated with.
|
|
16
|
+
"""
|
|
17
|
+
return self.properties.get("deviceName", None)
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def last_backup_datetime(self):
|
|
21
|
+
"""When the local administrator account credential was backed up to Azure Active Directory."""
|
|
22
|
+
return self.properties.get("lastBackupDateTime", datetime.min)
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
def refresh_datetime(self):
|
|
26
|
+
"""When the local administrator account credential will be refreshed and backed up to Azure Active Directory."""
|
|
27
|
+
return self.properties.get("refreshDateTime", datetime.min)
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
from office365.directory.authentication.conditions.event_listener import (
|
|
2
|
+
AuthenticationEventListener,
|
|
3
|
+
)
|
|
1
4
|
from office365.directory.identities.api_connector import IdentityApiConnector
|
|
2
5
|
from office365.directory.identities.conditional_access_root import ConditionalAccessRoot
|
|
3
6
|
from office365.directory.identities.providers.base_collection import (
|
|
@@ -18,6 +21,7 @@ class IdentityContainer(Entity):
|
|
|
18
21
|
|
|
19
22
|
@property
|
|
20
23
|
def api_connectors(self):
|
|
24
|
+
# type: () -> EntityCollection[IdentityApiConnector]
|
|
21
25
|
"""Represents entry point for API connectors."""
|
|
22
26
|
return self.properties.get(
|
|
23
27
|
"apiConnectors",
|
|
@@ -28,6 +32,19 @@ class IdentityContainer(Entity):
|
|
|
28
32
|
),
|
|
29
33
|
)
|
|
30
34
|
|
|
35
|
+
@property
|
|
36
|
+
def authentication_event_listeners(self):
|
|
37
|
+
# type: () -> EntityCollection[AuthenticationEventListener]
|
|
38
|
+
"""Get the collection of authenticationListener resources supported by the onSignupStart event."""
|
|
39
|
+
return self.properties.get(
|
|
40
|
+
"authenticationEventListeners",
|
|
41
|
+
EntityCollection(
|
|
42
|
+
self.context,
|
|
43
|
+
AuthenticationEventListener,
|
|
44
|
+
ResourcePath("authenticationEventListeners", self.resource_path),
|
|
45
|
+
),
|
|
46
|
+
)
|
|
47
|
+
|
|
31
48
|
@property
|
|
32
49
|
def conditional_access(self):
|
|
33
50
|
"""The entry point for the Conditional Access (CA) object model."""
|
|
@@ -76,6 +93,7 @@ class IdentityContainer(Entity):
|
|
|
76
93
|
if default_value is None:
|
|
77
94
|
property_mapping = {
|
|
78
95
|
"apiConnectors": self.api_connectors,
|
|
96
|
+
"authenticationEventListeners": self.authentication_event_listeners,
|
|
79
97
|
"b2xUserFlows": self.b2x_user_flows,
|
|
80
98
|
"conditionalAccess": self.conditional_access,
|
|
81
99
|
"identityProviders": self.identity_providers,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from office365.entity import Entity
|
|
2
4
|
|
|
3
5
|
|
|
@@ -7,3 +9,9 @@ class AuthenticationFlowsPolicy(Entity):
|
|
|
7
9
|
users request to sign up for approval. It contains information, such as the identifier, display name, and
|
|
8
10
|
description, and indicates whether self-service sign-up is enabled for the policy.
|
|
9
11
|
"""
|
|
12
|
+
|
|
13
|
+
@property
|
|
14
|
+
def display_name(self):
|
|
15
|
+
# type: () -> Optional[str]
|
|
16
|
+
"""The human-readable name of the policy."""
|
|
17
|
+
return self.properties.get("displayName", None)
|
|
@@ -13,6 +13,9 @@ from office365.directory.policies.cross_tenant_access import CrossTenantAccessPo
|
|
|
13
13
|
from office365.directory.policies.device_registration import DeviceRegistrationPolicy
|
|
14
14
|
from office365.directory.policies.permission_grant import PermissionGrantPolicy
|
|
15
15
|
from office365.directory.policies.tenant_app_management import TenantAppManagementPolicy
|
|
16
|
+
from office365.directory.policies.unified_role_management import (
|
|
17
|
+
UnifiedRoleManagementPolicy,
|
|
18
|
+
)
|
|
16
19
|
from office365.entity import Entity
|
|
17
20
|
from office365.entity_collection import EntityCollection
|
|
18
21
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
@@ -162,6 +165,19 @@ class PolicyRoot(Entity):
|
|
|
162
165
|
),
|
|
163
166
|
)
|
|
164
167
|
|
|
168
|
+
@property
|
|
169
|
+
def role_management_policies(self):
|
|
170
|
+
# type: () -> EntityCollection[UnifiedRoleManagementPolicy]
|
|
171
|
+
"""Specifies the various policies associated with scopes and roles."""
|
|
172
|
+
return self.properties.get(
|
|
173
|
+
"roleManagementPolicies",
|
|
174
|
+
EntityCollection(
|
|
175
|
+
self.context,
|
|
176
|
+
UnifiedRoleManagementPolicy,
|
|
177
|
+
ResourcePath("roleManagementPolicies", self.resource_path),
|
|
178
|
+
),
|
|
179
|
+
)
|
|
180
|
+
|
|
165
181
|
def get_property(self, name, default_value=None):
|
|
166
182
|
if default_value is None:
|
|
167
183
|
property_mapping = {
|
|
@@ -176,6 +192,7 @@ class PolicyRoot(Entity):
|
|
|
176
192
|
"defaultAppManagementPolicy": self.default_app_management_policy,
|
|
177
193
|
"deviceRegistrationPolicy": self.device_registration_policy,
|
|
178
194
|
"permissionGrantPolicies": self.permission_grant_policies,
|
|
195
|
+
"roleManagementPolicies": self.role_management_policies,
|
|
179
196
|
}
|
|
180
197
|
default_value = property_mapping.get(name, None)
|
|
181
198
|
return super(PolicyRoot, self).get_property(name, default_value)
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from office365.directory.permissions.identity_set import IdentitySet
|
|
2
|
+
from office365.entity import Entity
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ProtectionPolicyBase(Entity):
|
|
6
|
+
"""
|
|
7
|
+
Contains details about protection policies applied to Microsoft 365 data in an organization.
|
|
8
|
+
Protection policies are defined by the Global Admin (or the SharePoint Online Admin or Exchange Online Admin)
|
|
9
|
+
and include what data to protect, when to protect it, and for what time period to retain the protected data
|
|
10
|
+
for a single Microsoft 365 service.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
@property
|
|
14
|
+
def created_by(self):
|
|
15
|
+
"""Identity of the user, device, or application which created the item."""
|
|
16
|
+
return self.properties.get("createdBy", IdentitySet())
|
|
17
|
+
|
|
18
|
+
def get_property(self, name, default_value=None):
|
|
19
|
+
if default_value is None:
|
|
20
|
+
property_mapping = {
|
|
21
|
+
"createdBy": self.created_by,
|
|
22
|
+
}
|
|
23
|
+
default_value = property_mapping.get(name, None)
|
|
24
|
+
return super(ProtectionPolicyBase, self).get_property(name, default_value)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from office365.directory.protection.policy.base import ProtectionPolicyBase
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class OneDriveForBusinessProtectionPolicy(ProtectionPolicyBase):
|
|
5
|
+
"""
|
|
6
|
+
Contains details about protection policies applied to Microsoft 365 data in an organization.
|
|
7
|
+
Protection policies are defined by the Global Admin (or the SharePoint Online Admin or Exchange Online Admin)
|
|
8
|
+
and include what data to protect, when to protect it, and for what time period to retain the protected data
|
|
9
|
+
for a single Microsoft 365 service.
|
|
10
|
+
"""
|
|
@@ -3,3 +3,10 @@ from office365.runtime.client_value import ClientValue
|
|
|
3
3
|
|
|
4
4
|
class UserSimulationDetails(ClientValue):
|
|
5
5
|
"""Represents a user of a tenant and their online actions in an attack simulation and training campaign."""
|
|
6
|
+
|
|
7
|
+
def __init__(self, assigned_trainings_count=None):
|
|
8
|
+
"""
|
|
9
|
+
:param int assigned_trainings_count: Number of trainings assigned to a user in an attack simulation
|
|
10
|
+
and training campaign.
|
|
11
|
+
"""
|
|
12
|
+
self.assignedTrainingsCount = assigned_trainings_count
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from collections.abc import Callable
|
|
1
2
|
from typing import Optional
|
|
2
3
|
|
|
3
4
|
from typing_extensions import Self
|
|
@@ -102,7 +103,8 @@ class ServicePrincipal(DirectoryObject):
|
|
|
102
103
|
self.context.add_query(qry)
|
|
103
104
|
return return_type
|
|
104
105
|
|
|
105
|
-
def
|
|
106
|
+
def _get_service_principal_by_app(self, app, action):
|
|
107
|
+
# type: (Application|str, Callable[[Application], None]) -> None
|
|
106
108
|
if isinstance(app, Application):
|
|
107
109
|
|
|
108
110
|
def _after():
|
|
@@ -112,6 +114,54 @@ class ServicePrincipal(DirectoryObject):
|
|
|
112
114
|
else:
|
|
113
115
|
self.context.service_principals.get_by_app(app).get().after_execute(action)
|
|
114
116
|
|
|
117
|
+
def get_delegated(self, app, principal, scope=None):
|
|
118
|
+
# type: (Application|str, User|str, AppRole|str) -> DeltaCollection[OAuth2PermissionGrant]
|
|
119
|
+
"""Gets a delegated permission to the client service principal on behalf of a user"""
|
|
120
|
+
|
|
121
|
+
return_type = DeltaCollection(self.context, OAuth2PermissionGrant)
|
|
122
|
+
|
|
123
|
+
def _get_delegated(col):
|
|
124
|
+
# type: (DeltaCollection[OAuth2PermissionGrant]) -> None
|
|
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
|
+
]
|
|
133
|
+
|
|
134
|
+
def _principal_resolved(principal_id):
|
|
135
|
+
# type: (str) -> None
|
|
136
|
+
def _client_loaded(client):
|
|
137
|
+
# type: (ServicePrincipal) -> None
|
|
138
|
+
query_text = ("principalId eq '{0}' and clientId eq '{1}'").format(
|
|
139
|
+
principal_id, client.id
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
(
|
|
143
|
+
self.context.oauth2_permission_grants.get()
|
|
144
|
+
.filter(query_text)
|
|
145
|
+
.after_execute(_get_delegated)
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
self.context.service_principals.get_by_app(app).get().after_execute(
|
|
149
|
+
_client_loaded
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
def _resource_resolved():
|
|
153
|
+
if isinstance(principal, User):
|
|
154
|
+
|
|
155
|
+
def _after():
|
|
156
|
+
_principal_resolved(principal.id)
|
|
157
|
+
|
|
158
|
+
principal.ensure_property("id", _after)
|
|
159
|
+
else:
|
|
160
|
+
_principal_resolved(principal)
|
|
161
|
+
|
|
162
|
+
self.ensure_property("id", _resource_resolved)
|
|
163
|
+
return return_type
|
|
164
|
+
|
|
115
165
|
def grant_delegated(self, app, principal, scope):
|
|
116
166
|
# type: (Application|str, User|str, AppRole|str) -> Self
|
|
117
167
|
"""Grants a delegated permission to the client service principal on behalf of a user"""
|
|
@@ -126,30 +176,33 @@ class ServicePrincipal(DirectoryObject):
|
|
|
126
176
|
scope=scope,
|
|
127
177
|
)
|
|
128
178
|
|
|
129
|
-
def
|
|
130
|
-
|
|
179
|
+
def _principal_resolved(principal_id):
|
|
180
|
+
# type: (str) -> None
|
|
181
|
+
def _client_loaded(return_type):
|
|
131
182
|
_grant_delegated(principal_id, return_type.id)
|
|
132
183
|
|
|
133
|
-
self.
|
|
184
|
+
self.context.service_principals.get_by_app(app).get().after_execute(
|
|
185
|
+
_client_loaded
|
|
186
|
+
)
|
|
134
187
|
|
|
135
|
-
def
|
|
188
|
+
def _resource_resolved():
|
|
136
189
|
if isinstance(principal, User):
|
|
137
190
|
|
|
138
191
|
def _after():
|
|
139
|
-
|
|
192
|
+
_principal_resolved(principal.id)
|
|
140
193
|
|
|
141
194
|
principal.ensure_property("id", _after)
|
|
142
195
|
else:
|
|
143
|
-
|
|
196
|
+
_principal_resolved(principal)
|
|
144
197
|
|
|
145
|
-
self.ensure_property("id",
|
|
198
|
+
self.ensure_property("id", _resource_resolved)
|
|
146
199
|
return self
|
|
147
200
|
|
|
148
201
|
def revoke_delegated(self, app, principal, scope):
|
|
149
202
|
# type: (Application|str, User|str, AppRole|str) -> Self
|
|
150
203
|
""""""
|
|
151
204
|
|
|
152
|
-
def
|
|
205
|
+
def _revoke_delegated(app_id, principal_id):
|
|
153
206
|
# type: (str, str) -> None
|
|
154
207
|
|
|
155
208
|
def _after(return_type):
|
|
@@ -158,7 +211,6 @@ class ServicePrincipal(DirectoryObject):
|
|
|
158
211
|
query_text = "clientId eq '{0}' and principalId eq '{1}'".format(
|
|
159
212
|
app_id, principal_id
|
|
160
213
|
)
|
|
161
|
-
# query_text = "clientId eq '{0}'".format(app_id)
|
|
162
214
|
self.context.oauth2_permission_grants.filter(
|
|
163
215
|
query_text
|
|
164
216
|
).get().after_execute(_after)
|
|
@@ -167,14 +219,13 @@ class ServicePrincipal(DirectoryObject):
|
|
|
167
219
|
if isinstance(principal, User):
|
|
168
220
|
|
|
169
221
|
def _after():
|
|
170
|
-
|
|
222
|
+
_revoke_delegated(principal.id, return_type.id)
|
|
171
223
|
|
|
172
224
|
principal.ensure_property("id", _after)
|
|
173
225
|
else:
|
|
174
|
-
|
|
226
|
+
_revoke_delegated(principal, return_type.id)
|
|
175
227
|
|
|
176
|
-
self.
|
|
177
|
-
# self.ensure_property("id", _ensure_principal)
|
|
228
|
+
self._get_service_principal_by_app(app, _ensure_principal)
|
|
178
229
|
return self
|
|
179
230
|
|
|
180
231
|
def grant_application(self, app, app_role):
|
|
@@ -193,6 +193,16 @@ class User(DirectoryObject):
|
|
|
193
193
|
self.context.add_query(qry)
|
|
194
194
|
return return_type
|
|
195
195
|
|
|
196
|
+
def get_my_site(self):
|
|
197
|
+
"""Gets user's site"""
|
|
198
|
+
return_type = Site(self.context)
|
|
199
|
+
|
|
200
|
+
def _loaded():
|
|
201
|
+
return_type.set_property("webUrl", self.my_site)
|
|
202
|
+
|
|
203
|
+
self.ensure_property("mySite", _loaded)
|
|
204
|
+
return return_type
|
|
205
|
+
|
|
196
206
|
def send_mail(
|
|
197
207
|
self,
|
|
198
208
|
subject,
|
|
@@ -535,11 +545,21 @@ class User(DirectoryObject):
|
|
|
535
545
|
@property
|
|
536
546
|
def given_name(self):
|
|
537
547
|
# type: () -> Optional[str]
|
|
538
|
-
"""
|
|
539
|
-
The given name (first name) of the user. Maximum length is 64 characters.
|
|
540
|
-
"""
|
|
548
|
+
"""The given name (first name) of the user. Maximum length is 64 characters"""
|
|
541
549
|
return self.properties.get("givenName", None)
|
|
542
550
|
|
|
551
|
+
@property
|
|
552
|
+
def my_site(self):
|
|
553
|
+
# type: () -> Optional[str]
|
|
554
|
+
"""The URL for the user's site."""
|
|
555
|
+
return self.properties.get("mySite", None)
|
|
556
|
+
|
|
557
|
+
@property
|
|
558
|
+
def office_location(self):
|
|
559
|
+
# type: () -> Optional[str]
|
|
560
|
+
"""The office location in the user's place of business."""
|
|
561
|
+
return self.properties.get("officeLocation", None)
|
|
562
|
+
|
|
543
563
|
@property
|
|
544
564
|
def user_principal_name(self):
|
|
545
565
|
# type: () -> Optional[str]
|
office365/graph_client.py
CHANGED
|
@@ -229,16 +229,21 @@ class GraphClient(ClientRuntimeContext):
|
|
|
229
229
|
|
|
230
230
|
return GraphClient(_acquire_token)
|
|
231
231
|
|
|
232
|
-
def execute_batch(self, items_per_batch=
|
|
232
|
+
def execute_batch(self, items_per_batch=20, success_callback=None):
|
|
233
233
|
"""Constructs and submit a batch request
|
|
234
234
|
|
|
235
|
+
Per Batch size limitations: JSON batch requests are currently limited to 20 individual requests.
|
|
236
|
+
|
|
235
237
|
:param int items_per_batch: Maximum to be selected for bulk operation
|
|
238
|
+
:param (List[ClientObject|ClientResult])-> None success_callback: A success callback
|
|
236
239
|
"""
|
|
237
240
|
batch_request = ODataV4BatchRequest(V4JsonFormat())
|
|
238
241
|
batch_request.beforeExecute += self._authenticate_request
|
|
239
242
|
while self.has_pending_request:
|
|
240
243
|
qry = self._get_next_query(items_per_batch)
|
|
241
244
|
batch_request.execute_query(qry)
|
|
245
|
+
if callable(success_callback):
|
|
246
|
+
success_callback(qry.return_type)
|
|
242
247
|
return self
|
|
243
248
|
|
|
244
249
|
def pending_request(self):
|
|
@@ -9,6 +9,8 @@ from office365.intune.devices.enrollment.configuration import (
|
|
|
9
9
|
)
|
|
10
10
|
from office365.intune.devices.managed import ManagedDevice
|
|
11
11
|
from office365.intune.devices.management.reports.reports import DeviceManagementReports
|
|
12
|
+
from office365.intune.devices.management.terms_and_conditions import TermsAndConditions
|
|
13
|
+
from office365.intune.devices.management.virtual_endpoint import VirtualEndpoint
|
|
12
14
|
from office365.runtime.client_result import ClientResult
|
|
13
15
|
from office365.runtime.client_value_collection import ClientValueCollection
|
|
14
16
|
from office365.runtime.paths.resource_path import ResourcePath
|
|
@@ -40,6 +42,28 @@ class DeviceManagement(Entity):
|
|
|
40
42
|
),
|
|
41
43
|
)
|
|
42
44
|
|
|
45
|
+
@property
|
|
46
|
+
def virtual_endpoint(self):
|
|
47
|
+
""""""
|
|
48
|
+
return self.properties.get(
|
|
49
|
+
"virtualEndpoint",
|
|
50
|
+
VirtualEndpoint(
|
|
51
|
+
self.context, ResourcePath("virtualEndpoint", self.resource_path)
|
|
52
|
+
),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
@property
|
|
56
|
+
def terms_and_conditions(self):
|
|
57
|
+
""""""
|
|
58
|
+
return self.properties.get(
|
|
59
|
+
"termsAndConditions",
|
|
60
|
+
EntityCollection(
|
|
61
|
+
self.context,
|
|
62
|
+
TermsAndConditions,
|
|
63
|
+
ResourcePath("termsAndConditions", self.resource_path),
|
|
64
|
+
),
|
|
65
|
+
)
|
|
66
|
+
|
|
43
67
|
@property
|
|
44
68
|
def device_categories(self):
|
|
45
69
|
""""""
|
|
@@ -98,6 +122,8 @@ class DeviceManagement(Entity):
|
|
|
98
122
|
"deviceEnrollmentConfigurations": self.device_enrollment_configurations,
|
|
99
123
|
"intuneBrand": self.intune_brand,
|
|
100
124
|
"managedDevices": self.managed_devices,
|
|
125
|
+
"termsAndConditions": self.terms_and_conditions,
|
|
126
|
+
"virtualEndpoint": self.virtual_endpoint,
|
|
101
127
|
}
|
|
102
128
|
default_value = property_mapping.get(name, None)
|
|
103
129
|
return super(DeviceManagement, self).get_property(name, default_value)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from office365.entity import Entity
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class TermsAndConditions(Entity):
|
|
5
|
+
"""
|
|
6
|
+
A termsAndConditions entity represents the metadata and contents of a given Terms and Conditions (T&C) policy.
|
|
7
|
+
T&C policies’ contents are presented to users upon their first attempt to enroll into Intune and subsequently
|
|
8
|
+
upon edits where an administrator has required re-acceptance. They enable administrators to communicate
|
|
9
|
+
the provisions to which a user must agree in order to have devices enrolled into Intune.
|
|
10
|
+
"""
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from office365.runtime.client_value import ClientValue
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class IdleSessionSignOut(ClientValue):
|
|
5
|
+
"""Represents the idle session sign-out policy settings for SharePoint."""
|
|
6
|
+
|
|
7
|
+
def __init__(
|
|
8
|
+
self,
|
|
9
|
+
is_enabled=None,
|
|
10
|
+
sign_out_after_in_seconds=None,
|
|
11
|
+
warn_after_in_seconds=None,
|
|
12
|
+
):
|
|
13
|
+
self.isEnabled = is_enabled
|
|
14
|
+
self.signOutAfterInSeconds = sign_out_after_in_seconds
|
|
15
|
+
self.warnAfterInSeconds = warn_after_in_seconds
|