def __init__(self, *, parent=None, con=None, **kwargs):
        """ Permissions for DriveItem

        :param parent: parent for this operation
        :type parent: DriveItem
        :param Connection con: connection to use if no parent specified
        :param Protocol protocol: protocol to use if no parent specified
         (kwargs)
        :param str main_resource: use this resource instead of parent resource
         (kwargs)
        """
        if parent and con:
            raise ValueError('Need a parent or a connection but not both')
        self.con = parent.con if parent else con
        self._parent = parent if isinstance(parent, DriveItem) else None
        # Choose the main_resource passed in kwargs over parent main_resource
        main_resource = kwargs.pop('main_resource', None) or (
            getattr(parent, 'main_resource', None) if parent else None)

        protocol = parent.protocol if parent else kwargs.get('protocol')
        super().__init__(protocol=protocol, main_resource=main_resource)

        self.driveitem_id = self._parent.object_id
        cloud_data = kwargs.get(self._cloud_data_key, {})
        self.object_id = cloud_data.get(self._cc('id'))
        self.inherited_from = cloud_data.get(self._cc('inheritedFrom'), None)

        link = cloud_data.get(self._cc('link'), None)
        self.permission_type = 'owner'
        if link:
            self.permission_type = 'link'
            self.share_type = link.get('type', 'view')
            self.share_scope = link.get('scope', 'anonymous')
            self.share_link = link.get('webUrl', None)

        invitation = cloud_data.get(self._cc('invitation'), None)
        if invitation:
            self.permission_type = 'invitation'
            self.share_email = invitation.get('email', '')
            invited_by = invitation.get('invitedBy', {})
            self.invited_by = invited_by.get('user', {}).get(
                self._cc('displayName'), None) or invited_by.get('application',
                                                                 {}).get(
                self._cc('displayName'), None)
            self.require_sign_in = invitation.get(self._cc('signInRequired'),
                                                  True)

        self.roles = cloud_data.get(self._cc('roles'), [])
        granted_to = cloud_data.get(self._cc('grantedTo'), {})
        self.granted_to = granted_to.get('user', {}).get(
            self._cc('displayName')) or granted_to.get('application', {}).get(
            self._cc('displayName'))
        self.share_id = cloud_data.get(self._cc('shareId'), None)
def __init__ ( self , * , parent = None , con = None , ** kwargs ) : if parent and con : raise ValueError ( 'Need a parent or a connection but not both' ) self . con = parent . con if parent else con self . _parent = parent if isinstance ( parent , DriveItem ) else None main_resource = kwargs . pop ( 'main_resource' , None ) or ( getattr ( parent , 'main_resource' , None ) if parent else None ) protocol = parent . protocol if parent else kwargs . get ( 'protocol' ) super ( ) . __init__ ( protocol = protocol , main_resource = main_resource ) self . driveitem_id = self . _parent . object_id cloud_data = kwargs . get ( self . _cloud_data_key , { } ) self . object_id = cloud_data . get ( self . _cc ( 'id' ) ) self . inherited_from = cloud_data . get ( self . _cc ( 'inheritedFrom' ) , None ) link = cloud_data . get ( self . _cc ( 'link' ) , None ) self . permission_type = 'owner' if link : self . permission_type = 'link' self . share_type = link . get ( 'type' , 'view' ) self . share_scope = link . get ( 'scope' , 'anonymous' ) self . share_link = link . get ( 'webUrl' , None ) invitation = cloud_data . get ( self . _cc ( 'invitation' ) , None ) if invitation : self . permission_type = 'invitation' self . share_email = invitation . get ( 'email' , '' ) invited_by = invitation . get ( 'invitedBy' , { } ) self . invited_by = invited_by . get ( 'user' , { } ) . get ( self . _cc ( 'displayName' ) , None ) or invited_by . get ( 'application' , { } ) . get ( self . _cc ( 'displayName' ) , None ) self . require_sign_in = invitation . get ( self . _cc ( 'signInRequired' ) , True ) self . roles = cloud_data . get ( self . _cc ( 'roles' ) , [ ] ) granted_to = cloud_data . get ( self . _cc ( 'grantedTo' ) , { } ) self . granted_to = granted_to . get ( 'user' , { } ) . get ( self . _cc ( 'displayName' ) ) or granted_to . get ( 'application' , { } ) . get ( self . _cc ( 'displayName' ) ) self . share_id = cloud_data . get ( self . _cc ( 'shareId' ) , None )
Permissions for DriveItem

        :param parent: parent for this operation
        :type parent: DriveItem
        :param Connection con: connection to use if no parent specified
        :param Protocol protocol: protocol to use if no parent specified
         (kwargs)
        :param str main_resource: use this resource instead of parent resource
         (kwargs)