buffet: Move command minimal role checking into CommandManager
Code uses information available inside CommandManager.
BUG=brillo:1161
TEST=`FEATURES=test emerge-gizmo buffet`
Change-Id: I21bb7f6ca3923b5375c97eea4a05f942893f3ab1
Reviewed-on: https://chromium-review.googlesource.com/276361
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Tested-by: Vitaly Buka <vitalybuka@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
diff --git a/buffet/commands/command_manager.h b/buffet/commands/command_manager.h
index 9a891ba..5a1cc5e 100644
--- a/buffet/commands/command_manager.h
+++ b/buffet/commands/command_manager.h
@@ -87,6 +87,10 @@
// Adds a new command to the command queue.
void AddCommand(std::unique_ptr<CommandInstance> command_instance);
+ bool AddCommand(const base::DictionaryValue& command,
+ UserRole role,
+ std::string* id,
+ chromeos::ErrorPtr* error);
// Finds a command by the command |id|. Returns nullptr if the command with
// the given |id| is not found. The returned pointer should not be persisted
@@ -110,6 +114,7 @@
DBusCommandDispacher command_dispatcher_;
CommandQueue command_queue_;
std::vector<base::Callback<void()>> on_command_changed_;
+ uint32_t next_command_id_{0};
DISALLOW_COPY_AND_ASSIGN(CommandManager);
};