def set_folder(self, folder_id, auth): self.folder_id = str(folder_id) self._update_folder_data() self.save() # Add log to node nodelogger = BoxNodeLogger(node=self.owner, auth=auth) nodelogger.log(action="folder_selected", save=True)
def set_user_auth(self, user_settings): """Import a user's Box authentication and create a NodeLog. :param BoxUserSettings user_settings: The user settings to link. """ self.user_settings = user_settings nodelogger = BoxNodeLogger(node=self.owner, auth=Auth(user_settings.owner)) nodelogger.log(action="node_authorized", save=True)
def deauthorize(self, auth=None, add_log=True): """Remove user authorization from this node and log the event.""" node = self.owner if add_log: extra = {'folder_id': self.folder_id} nodelogger = BoxNodeLogger(node=node, auth=auth) nodelogger.log(action="node_deauthorized", extra=extra, save=True) self.folder_id = None self.user_settings = None self.save()
def set_folder(self, folder_id, auth): self.folder_id = str(folder_id) self._update_folder_data() self.save() if not self.complete: self.user_settings.grant_oauth_access( node=self.owner, external_account=self.external_account, metadata={'folder': self.folder_id}) self.user_settings.save() # Add log to node nodelogger = BoxNodeLogger(node=self.owner, auth=auth) nodelogger.log(action="folder_selected", save=True)
def set_folder(self, folder_id, auth): self.folder_id = str(folder_id) self._update_folder_data() self.save() if not self.complete: self.user_settings.grant_oauth_access( node=self.owner, external_account=self.external_account, metadata={'folder': self.folder_id} ) self.user_settings.save() # Add log to node nodelogger = BoxNodeLogger(node=self.owner, auth=auth) nodelogger.log(action="folder_selected", save=True)