MCPcopy Create free account
hub / github.com/O365/python-o365 / get_permissions

Method get_permissions

O365/drive.py:944–965  ·  view source on GitHub ↗

Returns a list of DriveItemPermissions with the permissions granted for this DriveItem. :return: List of Permissions :rtype: list[DriveItemPermission]

(self)

Source from the content-addressed store, hash-verified

942 return DriveItemPermission(parent=self, **{self._cloud_data_key: data})
943
944 def get_permissions(self):
945 """ Returns a list of DriveItemPermissions with the
946 permissions granted for this DriveItem.
947
948 :return: List of Permissions
949 :rtype: list[DriveItemPermission]
950 """
951 if not self.object_id:
952 return []
953
954 url = self.build_url(
955 self._endpoints.get('permissions').format(id=self.object_id))
956
957 response = self.con.get(url)
958 if not response:
959 return None
960
961 data = response.json()
962
963 # Everything received from cloud must be passed as self._cloud_data_key
964 return [DriveItemPermission(parent=self, **{self._cloud_data_key: item})
965 for item in data.get('value', [])]
966
967
968class File(DriveItem, DownloadableMixin):

Callers

nothing calls this directly

Calls 4

DriveItemPermissionClass · 0.85
build_urlMethod · 0.80
jsonMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected