Allow variable expansion in native printer policy
Enables variable expansion for the NativePrinters policy on Active
Directory managed devices. The expansion exchanges ${machine_name} by
the Active Directory computer name for all JSON fields. Also supports
substrings, e.g. ${machine_name,6,4} = 4 chars from pos 6. Cloud managed
devices usually don't have a human-readable device name, so expansion
isn't supported yet (although there's a machine_name field in PolicyData
that one might use). More variables and policies can be easily added in
the future.
BUG=chromium:829279
TEST=chromeos_unittests --gtest_filter=VariableExpanderTest.*
Set NativePrinters (aka 'Native Printing') policy in Active
Directory GPO with display_name = '${machine_name}' for some
printer. On AD managed device, get policy from the AD server and
print a page. Select printers. A printer with the name of the
Chromebook should appear. Also check device name shows up on
chrome://policy under NativePrinters.
Change-Id: I5fe6185b6bb48bf5d28a7ab4f53be1553fca18b5
Reviewed-on: https://chromium-review.googlesource.com/1001576
Commit-Queue: Lutz Justen <ljusten@chromium.org>
Reviewed-by: Dan Erat <derat@chromium.org>
Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org>
Reviewed-by: Sean Kau <skau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550466}
CrOS-Libchrome-Original-Commit: 09c943a7e347b831d53f02b426d8e9554b70a045
2 files changed