Skip to content

Commit 011287d

Browse files
committed
marketplace namespace updates
1 parent 712e16d commit 011287d

File tree

14 files changed

+304
-25
lines changed

14 files changed

+304
-25
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
3+
from office365.graph_client import GraphClient
4+
from tests import (
5+
test_client_id,
6+
test_client_secret,
7+
test_tenant,
8+
)
9+
10+
client = GraphClient(tenant=test_tenant).with_client_secret(
11+
test_client_id, test_client_secret
12+
)
13+
14+
resource = client.service_principals.get_by_app_id("00000003-0000-0ff1-ce00-000000000000")
15+
#principal = client.service_principals.get_by_app_id(test_client_id).get().execute_query()
16+
result = resource.get_application_permissions(test_client_id).execute_query()
17+
for app_role in result.value:
18+
print(app_role)

generator/metadata/SharePoint.xml

+134-20
Large diffs are not rendered by default.

office365/directory/serviceprincipals/service_principal.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from collections.abc import Callable
21
from typing import Optional
32

43
from typing_extensions import Self
@@ -249,6 +248,7 @@ def get_application_permissions(self, app):
249248
return_type = ClientResult(self.context, AppRoleCollection())
250249

251250
def _get_application_permissions(app_id):
251+
# type: (str) -> None
252252
app_role_ids = [
253253
app_role.app_role_id
254254
for app_role in self.app_role_assigned_to

office365/sharepoint/marketplace/corporatecuratedgallery/addins/instance_info.py

+22
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@
22

33

44
class SPAddinInstanceInfo(ClientValue):
5+
6+
def __init__(
7+
self,
8+
app_identifier=None,
9+
app_instance_id=None,
10+
tenant_app_data=None,
11+
tenant_app_data_update_time=None,
12+
title=None,
13+
):
14+
"""
15+
:param str app_identifier:
16+
:param str app_instance_id:
17+
:param str tenant_app_data:
18+
:param datetime.datetime tenant_app_data_update_time:
19+
:param str title:
20+
"""
21+
self.appIdentifier = app_identifier
22+
self.appInstanceId = app_instance_id
23+
self.tenantAppData = tenant_app_data
24+
self.tenantAppDataUpdateTime = tenant_app_data_update_time
25+
self.title = title
26+
527
@property
628
def entity_type_name(self):
729
return "Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.SPAddinInstanceInfo"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class SPAddinPermissionFailedInfo(ClientValue):
5+
""""""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class SPAddinPermissionInfo(ClientValue):
5+
""""""
6+
7+
def __init__(self, absolute_url=None):
8+
self.absoluteUrl = absolute_url
9+
10+
@property
11+
def entity_type_name(self):
12+
return "Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.SPAddinPermissionInfo"
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
from office365.runtime.client_value import ClientValue
2+
from office365.runtime.client_value_collection import ClientValueCollection
3+
from office365.sharepoint.marketplace.corporatecuratedgallery.addins.permission_failed_info import (
4+
SPAddinPermissionFailedInfo,
5+
)
6+
from office365.sharepoint.marketplace.corporatecuratedgallery.addins.permission_info import (
7+
SPAddinPermissionInfo,
8+
)
29

310

411
class SPAddinPermissionResponse(ClientValue):
512
""""""
613

14+
def __init__(self, addin_permissions=None, failed_addins=None):
15+
self.addinPermissions = ClientValueCollection(
16+
SPAddinPermissionInfo, addin_permissions
17+
)
18+
self.failedAddins = ClientValueCollection(
19+
SPAddinPermissionFailedInfo, failed_addins
20+
)
21+
722
@property
823
def entity_type_name(self):
924
return "Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.SPAddinPermissionResponse"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class SPGetAddinPrincipalsResponse(ClientValue):
5+
""""""

office365/sharepoint/marketplace/corporatecuratedgallery/available_addins_response.py

+5
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@
88
class SPAvailableAddinsResponse(ClientValue):
99
def __init__(self, addins=None):
1010
self.addins = ClientValueCollection(SPAddinInstanceInfo, addins)
11+
12+
13+
@property
14+
def entity_type_name(self):
15+
return "Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.SPAvailableAddinsResponse"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from office365.runtime.paths.resource_path import ResourcePath
2+
from office365.sharepoint.entity import Entity
3+
4+
5+
class SPOWebAppServicePrincipalPublic(Entity):
6+
""" """
7+
8+
def __init__(self, context):
9+
"""
10+
"""
11+
static_path = ResourcePath(
12+
"Microsoft.Online.SharePoint.TenantAdministration.SPOWebAppServicePrincipalPublic"
13+
)
14+
super(SPOWebAppServicePrincipalPublic, self).__init__(context, static_path)
15+
16+
@property
17+
def entity_type_name(self):
18+
return "Microsoft.Online.SharePoint.TenantAdministration.SPOWebAppServicePrincipalPublic"

office365/sharepoint/tenant/administration/internal/appservice/permission_request.py

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
class SPOWebAppServicePrincipalPermissionRequest(Entity):
55
""" """
6+
@property
7+
def client_component_item_unique_id(self):
8+
return self.properties.get("ClientComponentItemUniqueId", False)
69

710
@property
811
def entity_type_name(self):

office365/sharepoint/webs/web.py

+59
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
from office365.sharepoint.lists.render_data_parameters import RenderListDataParameters
5656
from office365.sharepoint.lists.template_collection import ListTemplateCollection
5757
from office365.sharepoint.lists.template_type import ListTemplateType
58+
from office365.sharepoint.marketplace.corporatecuratedgallery.addins.principals_response import (
59+
SPGetAddinPrincipalsResponse,
60+
)
5861
from office365.sharepoint.marketplace.corporatecuratedgallery.available_addins_response import (
5962
SPAvailableAddinsResponse,
6063
)
@@ -540,6 +543,26 @@ def get_all_client_side_components(self):
540543
self.context.add_query(qry)
541544
return return_type
542545

546+
def get_addin_principals_having_permissions_in_sites(
547+
self, server_relative_urls=None, urls=None
548+
):
549+
"""
550+
:param list[str] server_relative_urls:
551+
:param list[str] urls:
552+
"""
553+
payload = {"serverRelativeUrls": server_relative_urls, "urls": urls}
554+
return_type = ClientResult(self.context, SPGetAddinPrincipalsResponse())
555+
qry = ServiceOperationQuery(
556+
self,
557+
"GetAddinPrincipalsHavingPermissionsInSites",
558+
None,
559+
payload,
560+
None,
561+
return_type,
562+
)
563+
self.context.add_query(qry)
564+
return return_type
565+
543566
def get_app_bdc_catalog(self):
544567
"""
545568
Returns the Business Data Connectivity (BDC) MetadataCatalog for an application that gives access to the
@@ -645,6 +668,42 @@ def get_recycle_bin_items(
645668
self.context.add_query(qry)
646669
return return_type
647670

671+
def get_recycle_bin_items_by_query_info(
672+
self,
673+
is_ascending=True,
674+
item_state=None,
675+
order_by=None,
676+
paging_info=None,
677+
row_limit=100,
678+
show_only_my_items=False,
679+
):
680+
"""
681+
Gets the recycle bin items that are based on the specified query.
682+
683+
:param str paging_info: an Object that is used to obtain the next set of rows in a paged view of the Recycle Bin
684+
:param int row_limit: a limit for the number of items returned in the query per page.
685+
:param bool is_ascending: a Boolean value that specifies whether to sort in ascending order.
686+
:param int order_by: the column by which to order the Recycle Bin query.
687+
:param int item_state: Recycle Bin stage of items to return in the query.
688+
:param bool show_only_my_items:
689+
"""
690+
return_type = RecycleBinItemCollection(
691+
self.context, self.recycle_bin.resource_path
692+
)
693+
payload = {
694+
"rowLimit": row_limit,
695+
"isAscending": is_ascending,
696+
"pagingInfo": paging_info,
697+
"orderBy": order_by,
698+
"itemState": item_state,
699+
"ShowOnlyMyItems": show_only_my_items,
700+
}
701+
qry = ServiceOperationQuery(
702+
self, "GetRecycleBinItemsByQueryInfo", None, payload, None, return_type
703+
)
704+
self.context.add_query(qry)
705+
return return_type
706+
648707
def get_all_webs(self):
649708
"""Returns a collection containing a flat list of all Web objects in the Web."""
650709
from office365.sharepoint.webs.collection import WebCollection

tests/sharepoint/test_tenant.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,12 @@ def test_27_get_spo_all_web_templates(self):
202202
# self.assertIsNotNone(result.value)
203203

204204
def test_29_get_app_service_principal(self):
205-
from office365.sharepoint.tenant.administration.internal.appservice.principal import (
206-
SPOWebAppServicePrincipal,
205+
206+
from office365.sharepoint.tenant.administration.app_service_principal_public import (
207+
SPOWebAppServicePrincipalPublic,
207208
)
208209

209-
result = SPOWebAppServicePrincipal(self.client).get().execute_query()
210+
result = SPOWebAppServicePrincipalPublic(self.client).get().execute_query()
210211
self.assertIsNotNone(result.resource_path)
211212

212213
def test_30_get_cdn_urls(self):

tests/sharepoint/test_web.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,12 @@ def test_27_ensure_tenant_app_catalog(self):
202202
# result = self.client.web.ensure_edu_class_setup(True).execute_query()
203203
# self.assertIsNotNone(result.value)
204204

205-
# def test_30_get_acs_service_principals(self):
205+
#def test_30_get_acs_service_principals(self):
206206
# result = self.client.web.get_acs_service_principals().execute_query()
207207
# self.assertIsNotNone(result.value)
208208

209209
def test_31_get_access_request_list(self):
210210
result = self.client.web.get_access_request_list().get().execute_query()
211211
self.assertIsNotNone(result.resource_path)
212+
213+

0 commit comments

Comments
 (0)