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",
"display_name": "Content (browser process)",
"options": { "can_connect_to_other_services_as_any_user": true },
"interface_provider_specs": {
"service_manager:connector": {
"provides": {
......@@ -126,8 +127,7 @@
"service_manager": [
"service_manager:client_process",
"service_manager:instance_name",
"service_manager:service_manager",
"service_manager:user_id"
"service_manager:service_manager"
],
"shape_detection": [
"barcode_detection",
......
......@@ -9,7 +9,8 @@
"name": "content_packaged_services",
"display_name": "Content Packaged Services",
"options" : {
"instance_sharing" : "singleton"
"instance_sharing" : "singleton",
"can_connect_to_other_services_as_any_user": true
},
"interface_provider_specs": {
"service_manager:connector": {
......@@ -22,8 +23,7 @@
"*": [ "app" ],
"content_browser": [],
"service_manager": [
"service_manager:client_process",
"service_manager:user_id"
"service_manager:client_process"
]
}
}
......
{
"name": "web_browser",
"display_name": "Web",
"options": { "can_connect_to_other_services_as_any_user": true },
"interface_provider_specs": {
"service_manager:connector": {
"provides": {
......@@ -13,8 +14,7 @@
"service_manager": [
"service_manager:client_process",
"service_manager:instance_name",
"service_manager:service_manager",
"service_manager:user_id"
"service_manager:service_manager"
]
}
}
......
......@@ -9,7 +9,8 @@
"name": "web_packaged_services",
"display_name": "Web Packaged Services",
"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": {
"service_manager:connector": {
......@@ -21,8 +22,7 @@
"requires": {
"web_browser": [],
"service_manager": [
"service_manager:client_process",
"service_manager:user_id"
"service_manager:client_process"
]
}
}
......
......@@ -184,10 +184,10 @@ std::unique_ptr<Entry> Entry::Deserialize(const base::Value& manifest_root) {
<< instance_sharing;
}
if (const base::Value* allow_other_user_ids_value =
options->FindKey("allow_other_user_ids"))
options_struct.allow_other_user_ids =
allow_other_user_ids_value->GetBool();
if (const base::Value* can_connect_to_other_services_as_any_user_value =
options->FindKey("can_connect_to_other_services_as_any_user"))
options_struct.can_connect_to_other_services_as_any_user =
can_connect_to_other_services_as_any_user_value->GetBool();
if (const base::Value* allow_other_instance_names_value =
options->FindKey("allow_other_instance_names"))
......
......@@ -75,7 +75,7 @@ TEST_F(EntryTest, Options) {
EXPECT_EQ(ServiceOptions::InstanceSharingType::SINGLETON,
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().instance_for_client_process);
......
......@@ -15,7 +15,7 @@ struct ServiceOptions {
};
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 instance_for_client_process = false;
};
......
......@@ -3,7 +3,7 @@
"display_name": "Foo",
"options": {
"instance_sharing": "singleton",
"allow_other_user_ids": true,
"can_connect_to_other_services_as_any_user": true,
"allow_other_instance_names": true,
"instance_for_client_process": true
},
......
......@@ -10,9 +10,6 @@
// TODO(rockot): Fix this. We can bake this file into ServiceManager at
// build time or something. Same with service:catalog.
"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
// processes they launch themselves.
"service_manager:client_process": [ ],
......
......@@ -47,7 +47,6 @@ namespace service_manager {
namespace {
const char kCapability_UserID[] = "service_manager:user_id";
const char kCapability_ClientProcess[] = "service_manager:client_process";
const char kCapability_InstanceName[] = "service_manager:instance_name";
const char kCapability_ServiceManager[] = "service_manager:service_manager";
......@@ -614,7 +613,7 @@ class ServiceManager::Instance
options_.instance_sharing ==
catalog::ServiceOptions::InstanceSharingType::
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() &&
target.user_id() != mojom::kRootUserID) {
......
{
"name": "connect_test_app",
"display_name": "Connect Test App",
"options": { "can_connect_to_other_services_as_any_user": true },
"interface_provider_specs": {
"service_manager:connector": {
"provides": {
......@@ -18,8 +19,7 @@
"connect_test_class_app": [
"connect_unittests:class",
"connect_unittests:connect_test_service"
],
"service_manager": [ "service_manager:user_id" ]
]
}
}
}
......
......@@ -2,13 +2,9 @@
"name": "connect_test_sandboxed_app",
"display_name": "Sandboxed Connect Test App",
"sandbox_type": "superduper",
"options": { "can_connect_to_other_services_as_any_user": true },
"interface_provider_specs": {
"service_manager:connector": {
"provides": {
},
"requires": {
"service_manager": [ "service_manager:user_id" ]
}
}
}
}
{
"name": "connect_unittests",
"display_name": "Connect Unittests",
"options": { "can_connect_to_other_services_as_any_user": true },
"interface_provider_specs": {
"service_manager:connector": {
"provides": {
......@@ -27,8 +28,7 @@
],
"connect_test_singleton_app": [],
"service_manager": [
"service_manager:instance_name",
"service_manager:user_id"
"service_manager:instance_name"
]
}
}
......
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