-
-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SharePoint API: permissions and sharing namespaces changes
- Loading branch information
1 parent
99a9757
commit 92cc6ed
Showing
35 changed files
with
552 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.sharepoint.base_entity import BaseEntity | ||
|
||
|
||
class Form(BaseEntity): | ||
"""A form provides a display and editing interface for a single list item.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from office365.runtime.client_object_collection import ClientObjectCollection | ||
|
||
|
||
class FormCollection(ClientObjectCollection): | ||
|
||
def get_by_page_type(self): | ||
pass |
13 changes: 13 additions & 0 deletions
13
office365/sharepoint/permissions/roleAssignmentCollection.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from office365.runtime.client_object_collection import ClientObjectCollection | ||
|
||
|
||
class RoleAssignmentCollection(ClientObjectCollection): | ||
"""Represents a collection of RoleAssignment resources.""" | ||
|
||
def remove_role_assignment(self, principal_id, role_def_id): | ||
"""Removes the role assignment with the specified principal and role definition from the collection. | ||
:param int role_def_id: The ID of the role definition in the role assignment. | ||
:param int principal_id: The ID of the user or group in the role assignment. | ||
""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from office365.sharepoint.base_entity import BaseEntity | ||
|
||
|
||
class RoleDefinition(BaseEntity): | ||
"""Defines a single role definition, including a name, description, and set of rights.""" | ||
|
||
@property | ||
def name(self): | ||
"""Gets a value that specifies the role definition name.""" | ||
return self.properties.get('Name', None) | ||
|
||
@name.setter | ||
def name(self, value): | ||
"""Sets a value that specifies the role definition name.""" | ||
self.set_property('Name', value) | ||
|
||
@property | ||
def description(self): | ||
"""Gets or sets a value that specifies the description of the role definition.""" | ||
return self.properties.get('Description', None) | ||
|
||
@description.setter | ||
def description(self, value): | ||
"""Gets or sets a value that specifies the description of the role definition.""" | ||
self.set_property('Description', value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from office365.runtime.client_object_collection import ClientObjectCollection | ||
from office365.sharepoint.permissions.roleDefinition import RoleDefinition | ||
|
||
|
||
class RoleDefinitionCollection(ClientObjectCollection): | ||
|
||
def __init__(self, context, resource_path=None): | ||
super(RoleDefinitionCollection, self).__init__(context, RoleDefinition, resource_path) |
12 changes: 12 additions & 0 deletions
12
office365/sharepoint/permissions/roleDefinitionCreationInformation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from office365.runtime.clientValue import ClientValue | ||
from office365.sharepoint.permissions.basePermissions import BasePermissions | ||
|
||
|
||
class RoleDefinitionCreationInformation(ClientValue): | ||
|
||
def __init__(self): | ||
"""Contains properties that are used as parameters to initialize a role definition.""" | ||
super(RoleDefinitionCreationInformation, self).__init__() | ||
self.Name = None | ||
self.Description = None | ||
self.BasePermissions = BasePermissions() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from office365.sharepoint.base_entity import BaseEntity | ||
|
||
|
||
class Utility(BaseEntity): | ||
|
||
def __init__(self, context, resource_path): | ||
super().__init__(context, resource_path, "SP.Utilities") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class PrincipalSource: | ||
"""Specifies the source of a principal.""" | ||
|
||
def __init__(self): | ||
pass | ||
|
||
None_ = 0 | ||
UserInfoList = 1 | ||
Windows = 2 | ||
MembershipProvider = 4 | ||
RoleProvider = 8 | ||
All = 15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class PrincipalType: | ||
"""Specifies the type of a principal.""" | ||
|
||
def __init__(self): | ||
pass | ||
|
||
None_ = 0 | ||
User = 1 | ||
DistributionList = 2 | ||
SecurityGroup = 4 | ||
SharePointGroup = 8 | ||
All = 15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class ExternalSharingSiteOption: | ||
def __init__(self): | ||
pass | ||
|
||
Edit = "role:1073741827" | ||
View = "role:1073741826" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from office365.runtime.clientValue import ClientValue | ||
|
||
|
||
class SPInvitationCreationResult(ClientValue): | ||
|
||
def __init__(self): | ||
super().__init__("SP") | ||
self.Email = None | ||
self.InvitationLink = None | ||
self.Succeeded = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.sharepoint.base_entity import BaseEntity | ||
|
||
|
||
class ObjectSharingInformation(BaseEntity): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from office365.runtime.resource_path import ResourcePath | ||
from office365.sharepoint.base_entity import BaseEntity | ||
from office365.sharepoint.sharing.objectSharingInformation import ObjectSharingInformation | ||
|
||
|
||
class ObjectSharingSettings(BaseEntity): | ||
|
||
@property | ||
def web_url(self): | ||
""" | ||
:return: str | ||
""" | ||
return self.properties.get("WebUrl", None) | ||
|
||
@property | ||
def object_sharing_information(self): | ||
return self.properties.get("ObjectSharingInformation", | ||
ObjectSharingInformation(self.context, | ||
ResourcePath("ObjectSharingInformation", | ||
self.resource_path))) |
11 changes: 11 additions & 0 deletions
11
office365/sharepoint/sharing/pickerEntityInformationRequest.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from office365.runtime.clientValue import ClientValue | ||
|
||
|
||
class PickerEntityInformationRequest(ClientValue): | ||
|
||
def __init__(self): | ||
super().__init__() | ||
self.Key = None | ||
self.GroupId = None | ||
self.PrincipalType = None | ||
self.EmailAddress = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class SharedObjectType: | ||
|
||
def __init__(self): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from office365.runtime.clientValue import ClientValue | ||
|
||
|
||
class SharingLinkAccessRequest(ClientValue): | ||
|
||
def __init__(self): | ||
super().__init__() | ||
self.ensureAccess = None | ||
self.password = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from office365.runtime.clientValueCollection import ClientValueCollection | ||
from office365.runtime.resource_path import ResourcePath | ||
from office365.sharepoint.base_entity import BaseEntity | ||
from office365.sharepoint.principal.group_collection import GroupCollection | ||
from office365.sharepoint.sharing.invitationCreationResult import SPInvitationCreationResult | ||
from office365.sharepoint.sharing.userSharingResult import UserSharingResult | ||
|
||
|
||
class SharingResult(BaseEntity): | ||
|
||
def __init__(self, context): | ||
super().__init__(context) | ||
|
||
@property | ||
def errorMessage(self): | ||
return self.properties.get("ErrorMessage", None) | ||
|
||
@property | ||
def name(self): | ||
return self.properties.get("Name", None) | ||
|
||
@property | ||
def iconUrl(self): | ||
return self.properties.get("IconUrl", None) | ||
|
||
@property | ||
def statusCode(self): | ||
return self.properties.get("StatusCode", None) | ||
|
||
@property | ||
def permissionsPageRelativeUrl(self): | ||
return self.properties.get("PermissionsPageRelativeUrl", None) | ||
|
||
@property | ||
def invited_users(self): | ||
return self.properties.get("InvitedUsers", ClientValueCollection(SPInvitationCreationResult())) | ||
|
||
@property | ||
def uniquelyPermissionedUsers(self): | ||
return self.properties.get("UniquelyPermissionedUsers", ClientValueCollection(UserSharingResult())) | ||
|
||
@property | ||
def groupsSharedWith(self): | ||
return self.properties.get("GroupsSharedWith", | ||
GroupCollection(self.context, ResourcePath("GroupsSharedWith", self.resource_path))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from office365.runtime.queries.serviceOperationQuery import ServiceOperationQuery | ||
from office365.runtime.resource_path import ResourcePath | ||
from office365.sharepoint.base_entity import BaseEntity | ||
from office365.sharepoint.sharing.userDirectoryInfo import UserDirectoryInfo | ||
|
||
|
||
class SharingUtility(BaseEntity): | ||
|
||
def __init__(self, context): | ||
super().__init__(context, ResourcePath("SharingUtility")) | ||
|
||
@staticmethod | ||
def get_user_directory_info_by_email(context, email): | ||
""" | ||
:param str email: | ||
:param office365.sharepoint.client_context.ClientContext context: | ||
""" | ||
result = UserDirectoryInfo() | ||
payload = { | ||
"email": email | ||
} | ||
utility = SharingUtility(context) | ||
qry = ServiceOperationQuery(utility, "GetUserDirectoryInfoByEmail", None, payload, None, result) | ||
qry.static = True | ||
context.add_query(qry) | ||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.runtime.clientValue import ClientValue | ||
|
||
|
||
class UserDirectoryInfo(ClientValue): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from office365.runtime.clientValue import ClientValue | ||
from office365.runtime.clientValueCollection import ClientValueCollection | ||
|
||
|
||
class UserSharingResult(ClientValue): | ||
|
||
def __init__(self): | ||
super().__init__("SP.Sharing") | ||
self.AllowedRoles = ClientValueCollection(int) | ||
self.CurrentRole = None | ||
self.DisplayName = None | ||
self.Email = None | ||
self.InvitationLink = None | ||
self.IsUserKnown = None | ||
self.Message = None | ||
self.Status = None | ||
self.User = None |
Empty file.
Empty file.
Oops, something went wrong.