예제 #1
0
파일: model.py 프로젝트: GageGaskins/osf.io
    def set_user_auth(self, user_settings):
        """Import a user's GoogleDrive authentication and create a NodeLog.

        :param GoogleDriveUserSettings user_settings: The user settings to link.
        """
        self.user_settings = user_settings
        nodelogger = GoogleDriveNodeLogger(node=self.owner, auth=Auth(user_settings.owner))
        nodelogger.log(action="node_authorized", save=True)
예제 #2
0
파일: model.py 프로젝트: GageGaskins/osf.io
    def set_folder(self, folder, auth, add_log=True):
        self.folder_id = folder['id']
        self.folder_path = folder['path']

        # Add log to node
        if add_log:
            nodelogger = GoogleDriveNodeLogger(node=self.owner, auth=auth)
            nodelogger.log(action="folder_selected", save=True)
예제 #3
0
    def set_folder(self, folder, auth, add_log=True):
        self.folder_id = folder['id']
        self.folder_path = folder['path']

        # Add log to node
        if add_log:
            nodelogger = GoogleDriveNodeLogger(node=self.owner, auth=auth)
            nodelogger.log(action="folder_selected", save=True)
예제 #4
0
    def set_user_auth(self, user_settings):
        """Import a user's GoogleDrive authentication and create a NodeLog.

        :param GoogleDriveUserSettings user_settings: The user settings to link.
        """
        self.user_settings = user_settings
        nodelogger = GoogleDriveNodeLogger(node=self.owner,
                                           auth=Auth(user_settings.owner))
        nodelogger.log(action="node_authorized", save=True)
예제 #5
0
파일: model.py 프로젝트: GageGaskins/osf.io
    def deauthorize(self, auth=None, add_log=True):
        """Remove user authorization from this node and log the event."""
        if add_log:
            extra = {'folder': self.folder_name}
            nodelogger = GoogleDriveNodeLogger(node=self.owner, auth=auth)
            nodelogger.log(action="node_deauthorized", extra=extra, save=True)

        self.folder_id = None
        self.folder_path = None
        self.user_settings = None

        self.save()
예제 #6
0
    def deauthorize(self, auth=None, add_log=True):
        """Remove user authorization from this node and log the event."""
        if add_log:
            extra = {'folder': self.folder_name}
            nodelogger = GoogleDriveNodeLogger(node=self.owner, auth=auth)
            nodelogger.log(action="node_deauthorized", extra=extra, save=True)

        self.folder_id = None
        self.folder_path = None
        self.user_settings = None

        self.save()