def get(self, board_id): """Get board permissions for the current user. :param board_id: The ID of the board. """ board = boards_api.get(board_id) if boards_api.visible(board, request.current_user_id): return boards_api.get_permissions(board, request.current_user_id) else: raise exc.NotFound(_("Board %s not found") % board_id)
def editable(worklist, user=None): if not worklist: return False if not user: return False if is_lane(worklist): board = boards.get_from_lane(worklist) permissions = boards.get_permissions(board, user) return any(name in permissions for name in ['edit_board', 'move_cards']) return 'edit_worklist' in get_permissions(worklist, user)
def visible(worklist, user=None, hide_lanes=False): if hide_lanes: if is_lane(worklist): return False if not worklist: return False if is_lane(worklist): board = boards.get_from_lane(worklist) permissions = boards.get_permissions(board, user) if board.private: return any(name in permissions for name in ['edit_board', 'move_cards']) return not board.private if user and worklist.private: permissions = get_permissions(worklist, user) return any(name in permissions for name in ['edit_worklist', 'move_items']) return not worklist.private