def display_page_item(self, node_token, result, data, session): # TD doc string # check permissions etc if not self.permissions or authenticate.check_permission(self.permissions): # FIXME result.results[0] is horrible self.custom_control_display(node_token, result, data, session)
def save_page_item(self, node_token, save_set, data, session): # TD doc string # check we are allowed to save this item # TD what about invisibles? if not self.permissions or authenticate.check_permission(self.permissions): self.custom_control_save(node_token, save_set, data, session)
def build_items(items): # checks the permissions output = [] for item in items: if not authenticate.check_permission(item.get('permissions')): continue menu_item = {} if 'title' in item: menu_item['title'] = item['title'] if 'node' in item: menu_item['node'] = item['node'] if 'function' in item: menu_item['function'] = item['function'] if 'sub' in item: sub_items = build_items(item['sub']) if sub_items: menu_item['sub'] = sub_items output.append(menu_item) return output
def call(self, node_token): """called when the node is used. Checks to see if there is a function to call for the given command""" # first check if the command is available command_info = self.commands.get(node_token.command) if not command_info: return # check we have the needed permissions if command_info.get('permissions'): if not authenticate.check_permission(command_info.get('permissions')): node_token.forbidden() print 'forbidden' return command = command_info.get('command') if command: command = getattr(self, command) command(node_token) else: error = "Command '%s' in node '%s' not known" % (node_token.command, self.name) node_token.general_error(error)
def get_page_item_structure(self, node_token, data): if not self.permissions or authenticate.check_permission(self.permissions): return self.custom_page_item_structure(node_token, data)
def delete_page_item(self, node_token, object, data, session): # TD doc string # FIXME Not called from anywhere AFAIK # check permissions etc if not self.permissions or authenticate.check_permission(self.permissions): self.custom_control_delete(node_token, object, data, session)
def check_permissions(self): return authenticate.check_permission(self.permissions)