Skip to content

Commit e1c5f33

Browse files
committed
Fix warning: DeprecatedWarning: share is deprecated as of 2.3.0 and has be removed in 3.0.0. Use Item.sharing instead.
1 parent f73a9c1 commit e1c5f33

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

update_ags_online_fs.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from arcgis.gis import GIS
55
import logging
66
import datetime
7+
from arcgis.gis._impl._content_manager import SharingLevel
78

89

910
# load settings from settings_ags_online.py
@@ -64,9 +65,20 @@ def update_feature_services(project_path, sd_fs_name):
6465
LOGGER.info("Overwriting existing feature service...")
6566
fs = sdItem.publish(overwrite=True)
6667

67-
if shrOrg or shrEveryone or shrGroups:
68-
LOGGER.debug("Setting sharing options...")
69-
fs.share(org=shrOrg, everyone=shrEveryone, groups=shrGroups)
68+
#if shrOrg or shrEveryone or shrGroups:
69+
LOGGER.debug("Setting sharing options...")
70+
# fs.share(org=shrOrg, everyone=shrEveryone, groups=shrGroups)
71+
sharing_mgr = fs.sharing
72+
if shrOrg:
73+
sharing_mgr.sharing_level = SharingLevel.ORG
74+
if shrEveryone:
75+
sharing_mgr.sharing_level = SharingLevel.EVERYONE
76+
if shrGroups:
77+
for groupID in shrGroups:
78+
group = gis.groups.get(groupID)
79+
item_grp_sharing_mgr = sharing_mgr.groups
80+
item_grp_sharing_mgr.add(group=group)
81+
7082

7183
LOGGER.info("Finished updating: {} – ID: {}".format(fs.title, fs.id))
7284
else:

0 commit comments

Comments
 (0)