Commit 1f5eae7d authored by Oksana Zhuravlova's avatar Oksana Zhuravlova Committed by Commit Bot

Convert "user_id" to "can_connect_to_other_services_as_any_user"

This change updates the service_manager::Instance code to reference its
options_.can_connect_to_other_services_as_any_user value instead of
"service_manager:user_id" in the "required" section of its interface
provider specs.
Tests and existing manifests were updated accordingly.

Bug: 866967
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: I7c6529ef8e6cb8267710dc96ee009bec4c7f352a
Reviewed-on: https://chromium-review.googlesource.com/1203714
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588965}
parent e296bd11
{ {
"name": "content_browser", "name": "content_browser",
"display_name": "Content (browser process)", "display_name": "Content (browser process)",
"options": { "can_connect_to_other_services_as_any_user": true },
"interface_provider_specs": { "interface_provider_specs": {
"service_manager:connector": { "service_manager:connector": {
"provides": { "provides": {
...@@ -126,8 +127,7 @@ ...@@ -126,8 +127,7 @@
"service_manager": [ "service_manager": [
"service_manager:client_process", "service_manager:client_process",
"service_manager:instance_name", "service_manager:instance_name",
"service_manager:service_manager", "service_manager:service_manager"
"service_manager:user_id"
], ],
"shape_detection": [ "shape_detection": [
"barcode_detection", "barcode_detection",
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
"name": "content_packaged_services", "name": "content_packaged_services",
"display_name": "Content Packaged Services", "display_name": "Content Packaged Services",
"options" : { "options" : {
"instance_sharing" : "singleton" "instance_sharing" : "singleton",
"can_connect_to_other_services_as_any_user": true
}, },
"interface_provider_specs": { "interface_provider_specs": {
"service_manager:connector": { "service_manager:connector": {
...@@ -22,8 +23,7 @@ ...@@ -22,8 +23,7 @@
"*": [ "app" ], "*": [ "app" ],
"content_browser": [], "content_browser": [],
"service_manager": [ "service_manager": [
"service_manager:client_process", "service_manager:client_process"
"service_manager:user_id"
] ]
} }
} }
......
{ {
"name": "web_browser", "name": "web_browser",
"display_name": "Web", "display_name": "Web",
"options": { "can_connect_to_other_services_as_any_user": true },
"interface_provider_specs": { "interface_provider_specs": {
"service_manager:connector": { "service_manager:connector": {
"provides": { "provides": {
...@@ -13,8 +14,7 @@ ...@@ -13,8 +14,7 @@
"service_manager": [ "service_manager": [
"service_manager:client_process", "service_manager:client_process",
"service_manager:instance_name", "service_manager:instance_name",
"service_manager:service_manager", "service_manager:service_manager"
"service_manager:user_id"
] ]
} }
} }
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
"name": "web_packaged_services", "name": "web_packaged_services",
"display_name": "Web Packaged Services", "display_name": "Web Packaged Services",
"options" : { "options" : {
"instance_sharing" : "shared_instance_across_users" "instance_sharing" : "shared_instance_across_users",
"can_connect_to_other_services_as_any_user": true
}, },
"interface_provider_specs": { "interface_provider_specs": {
"service_manager:connector": { "service_manager:connector": {
...@@ -21,8 +22,7 @@ ...@@ -21,8 +22,7 @@
"requires": { "requires": {
"web_browser": [], "web_browser": [],
"service_manager": [ "service_manager": [
"service_manager:client_process", "service_manager:client_process"
"service_manager:user_id"
] ]
} }
} }
......
...@@ -184,10 +184,10 @@ std::unique_ptr<Entry> Entry::Deserialize(const base::Value& manifest_root) { ...@@ -184,10 +184,10 @@ std::unique_ptr<Entry> Entry::Deserialize(const base::Value& manifest_root) {
<< instance_sharing; << instance_sharing;
} }
if (const base::Value* allow_other_user_ids_value = if (const base::Value* can_connect_to_other_services_as_any_user_value =
options->FindKey("allow_other_user_ids")) options->FindKey("can_connect_to_other_services_as_any_user"))
options_struct.allow_other_user_ids = options_struct.can_connect_to_other_services_as_any_user =
allow_other_user_ids_value->GetBool(); can_connect_to_other_services_as_any_user_value->GetBool();
if (const base::Value* allow_other_instance_names_value = if (const base::Value* allow_other_instance_names_value =
options->FindKey("allow_other_instance_names")) options->FindKey("allow_other_instance_names"))
......
...@@ -75,7 +75,7 @@ TEST_F(EntryTest, Options) { ...@@ -75,7 +75,7 @@ TEST_F(EntryTest, Options) {
EXPECT_EQ(ServiceOptions::InstanceSharingType::SINGLETON, EXPECT_EQ(ServiceOptions::InstanceSharingType::SINGLETON,
entry->options().instance_sharing); entry->options().instance_sharing);
EXPECT_TRUE(entry->options().allow_other_user_ids); EXPECT_TRUE(entry->options().can_connect_to_other_services_as_any_user);
EXPECT_TRUE(entry->options().allow_other_instance_names); EXPECT_TRUE(entry->options().allow_other_instance_names);
EXPECT_TRUE(entry->options().instance_for_client_process); EXPECT_TRUE(entry->options().instance_for_client_process);
......
...@@ -15,7 +15,7 @@ struct ServiceOptions { ...@@ -15,7 +15,7 @@ struct ServiceOptions {
}; };
InstanceSharingType instance_sharing = InstanceSharingType::NONE; InstanceSharingType instance_sharing = InstanceSharingType::NONE;
bool allow_other_user_ids = false; bool can_connect_to_other_services_as_any_user = false;
bool allow_other_instance_names = false; bool allow_other_instance_names = false;
bool instance_for_client_process = false; bool instance_for_client_process = false;
}; };
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"display_name": "Foo", "display_name": "Foo",
"options": { "options": {
"instance_sharing": "singleton", "instance_sharing": "singleton",
"allow_other_user_ids": true, "can_connect_to_other_services_as_any_user": true,
"allow_other_instance_names": true, "allow_other_instance_names": true,
"instance_for_client_process": true "instance_for_client_process": true
}, },
......
...@@ -10,9 +10,6 @@ ...@@ -10,9 +10,6 @@
// TODO(rockot): Fix this. We can bake this file into ServiceManager at // TODO(rockot): Fix this. We can bake this file into ServiceManager at
// build time or something. Same with service:catalog. // build time or something. Same with service:catalog.
"provides": { "provides": {
// Clients requesting this class are able to connect to other clients as
// specific users other than their own.
"service_manager:user_id": [ ],
// Clients requesting this class are allowed to register clients for // Clients requesting this class are allowed to register clients for
// processes they launch themselves. // processes they launch themselves.
"service_manager:client_process": [ ], "service_manager:client_process": [ ],
......
...@@ -47,7 +47,6 @@ namespace service_manager { ...@@ -47,7 +47,6 @@ namespace service_manager {
namespace { namespace {
const char kCapability_UserID[] = "service_manager:user_id";
const char kCapability_ClientProcess[] = "service_manager:client_process"; const char kCapability_ClientProcess[] = "service_manager:client_process";
const char kCapability_InstanceName[] = "service_manager:instance_name"; const char kCapability_InstanceName[] = "service_manager:instance_name";
const char kCapability_ServiceManager[] = "service_manager:service_manager"; const char kCapability_ServiceManager[] = "service_manager:service_manager";
...@@ -614,7 +613,7 @@ class ServiceManager::Instance ...@@ -614,7 +613,7 @@ class ServiceManager::Instance
options_.instance_sharing == options_.instance_sharing ==
catalog::ServiceOptions::InstanceSharingType:: catalog::ServiceOptions::InstanceSharingType::
SHARED_INSTANCE_ACROSS_USERS || SHARED_INSTANCE_ACROSS_USERS ||
HasCapability(connection_spec, kCapability_UserID); options_.can_connect_to_other_services_as_any_user;
if (!skip_user_check && target.user_id() != identity_.user_id() && if (!skip_user_check && target.user_id() != identity_.user_id() &&
target.user_id() != mojom::kRootUserID) { target.user_id() != mojom::kRootUserID) {
......
{ {
"name": "connect_test_app", "name": "connect_test_app",
"display_name": "Connect Test App", "display_name": "Connect Test App",
"options": { "can_connect_to_other_services_as_any_user": true },
"interface_provider_specs": { "interface_provider_specs": {
"service_manager:connector": { "service_manager:connector": {
"provides": { "provides": {
...@@ -18,8 +19,7 @@ ...@@ -18,8 +19,7 @@
"connect_test_class_app": [ "connect_test_class_app": [
"connect_unittests:class", "connect_unittests:class",
"connect_unittests:connect_test_service" "connect_unittests:connect_test_service"
], ]
"service_manager": [ "service_manager:user_id" ]
} }
} }
} }
......
...@@ -2,13 +2,9 @@ ...@@ -2,13 +2,9 @@
"name": "connect_test_sandboxed_app", "name": "connect_test_sandboxed_app",
"display_name": "Sandboxed Connect Test App", "display_name": "Sandboxed Connect Test App",
"sandbox_type": "superduper", "sandbox_type": "superduper",
"options": { "can_connect_to_other_services_as_any_user": true },
"interface_provider_specs": { "interface_provider_specs": {
"service_manager:connector": { "service_manager:connector": {
"provides": {
},
"requires": {
"service_manager": [ "service_manager:user_id" ]
}
} }
} }
} }
{ {
"name": "connect_unittests", "name": "connect_unittests",
"display_name": "Connect Unittests", "display_name": "Connect Unittests",
"options": { "can_connect_to_other_services_as_any_user": true },
"interface_provider_specs": { "interface_provider_specs": {
"service_manager:connector": { "service_manager:connector": {
"provides": { "provides": {
...@@ -27,8 +28,7 @@ ...@@ -27,8 +28,7 @@
], ],
"connect_test_singleton_app": [], "connect_test_singleton_app": [],
"service_manager": [ "service_manager": [
"service_manager:instance_name", "service_manager:instance_name"
"service_manager:user_id"
] ]
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment