New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 829279 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Apr 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug



Sign in to add a comment

Allow native printer variable replacement by substring of machine name

Project Member Reported by ljusten@chromium.org, Apr 5 2018

Issue description

- Allow variable replacements in printer policies.
- Allow substrings (start, size).
- Allow replacement of multiple strings per line.

Example:

Machine name:
MACHINE_123

Printer policy
[{ "uri": "ipp://SERVER_${machine_name,8,3}:345/printers/PRT_${machine_name,8,3}_1", ...
}]

The uri should replace ${machine_name, 8, 3} by the 3 character starting at the 8-th position, i.e. 123.

 
See
policy_path_parser_win.cc
policy_path_parser_linux.cc
policy_path_parser.cc
Description: Show this description
Summary: Allow native printer variable replacement by substring of machine name (was: Allow native printer filtering by substring of machine name)
Project Member

Comment 4 by bugdroid1@chromium.org, Apr 12 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/2699d746b3b110bea6ad45a5c111e6b68d2764d6

commit 2699d746b3b110bea6ad45a5c111e6b68d2764d6
Author: Lutz Justen <ljusten@chromium.org>
Date: Thu Apr 12 22:22:23 2018

authpolicy: Add component ID and machine_name to PolicyData

Component id is going to be used during component policy validation.
Machine name is useful for variable replacement, so the machine name
is available in UserActiveDirectoryPolicyManager.

BUG= chromium:829279 , chromium:735100 
TEST=cros_run_unit_tests --board=amd64-generic --packages authpolicy

Change-Id: Ia4adf15ecef7f72beb3cc27ad4a773f375abd834
Reviewed-on: https://chromium-review.googlesource.com/1005036
Commit-Ready: Lutz Justen <ljusten@chromium.org>
Tested-by: Lutz Justen <ljusten@chromium.org>
Reviewed-by: Lutz Justen <ljusten@chromium.org>

[modify] https://crrev.com/2699d746b3b110bea6ad45a5c111e6b68d2764d6/authpolicy/authpolicy.cc
[modify] https://crrev.com/2699d746b3b110bea6ad45a5c111e6b68d2764d6/authpolicy/authpolicy_unittest.cc

Project Member

Comment 5 by bugdroid1@chromium.org, Apr 13 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/09c943a7e347b831d53f02b426d8e9554b70a045

commit 09c943a7e347b831d53f02b426d8e9554b70a045
Author: Lutz Justen <ljusten@chromium.org>
Date: Fri Apr 13 01:49:19 2018

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}
[modify] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chrome/browser/chromeos/policy/active_directory_policy_manager.cc
[modify] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chrome/browser/chromeos/policy/active_directory_policy_manager.h
[modify] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/BUILD.gn
[add] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/test/data/variable_expander/fuzzer.dict
[add] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/test/data/variable_expander/fuzzer_corpus/test1
[add] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/test/data/variable_expander/fuzzer_corpus/test2
[add] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/test/data/variable_expander/fuzzer_corpus/test3
[add] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/tools/variable_expander.cc
[add] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/tools/variable_expander.h
[add] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/tools/variable_expander_fuzzer.cc
[add] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/tools/variable_expander_unittest.cc
[modify] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/components/policy/core/common/policy_map.cc
[modify] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/components/policy/core/common/policy_map.h
[modify] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/components/policy/resources/policy_templates.json

Project Member

Comment 6 by bugdroid1@chromium.org, Apr 16 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ead3110f47a6112c5bb20c08dbe16c1e66446788

commit ead3110f47a6112c5bb20c08dbe16c1e66446788
Author: Lutz Justen <ljusten@chromium.org>
Date: Mon Apr 16 16:07:32 2018

Clean up VariableExpander

Removes unnecessary SetVariable method (can use constructor). Documents usage.

BUG= chromium:829279 
TEST=Tryjobs

Change-Id: I44ac2f93cd65fcd2e36814c659956fbdb0dc8277
Reviewed-on: https://chromium-review.googlesource.com/1013937
Reviewed-by: Dan Erat <derat@chromium.org>
Commit-Queue: Lutz Justen <ljusten@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550983}
[modify] https://crrev.com/ead3110f47a6112c5bb20c08dbe16c1e66446788/chrome/browser/chromeos/policy/active_directory_policy_manager.cc
[modify] https://crrev.com/ead3110f47a6112c5bb20c08dbe16c1e66446788/chromeos/tools/variable_expander.cc
[modify] https://crrev.com/ead3110f47a6112c5bb20c08dbe16c1e66446788/chromeos/tools/variable_expander.h
[modify] https://crrev.com/ead3110f47a6112c5bb20c08dbe16c1e66446788/chromeos/tools/variable_expander_unittest.cc

Status: Fixed (was: Assigned)
Project Member

Comment 8 by bugdroid1@chromium.org, Apr 17 2018

Labels: merge-merged-testbranch
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/09c943a7e347b831d53f02b426d8e9554b70a045

commit 09c943a7e347b831d53f02b426d8e9554b70a045
Author: Lutz Justen <ljusten@chromium.org>
Date: Fri Apr 13 01:49:19 2018

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}
[modify] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chrome/browser/chromeos/policy/active_directory_policy_manager.cc
[modify] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chrome/browser/chromeos/policy/active_directory_policy_manager.h
[modify] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/BUILD.gn
[add] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/test/data/variable_expander/fuzzer.dict
[add] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/test/data/variable_expander/fuzzer_corpus/test1
[add] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/test/data/variable_expander/fuzzer_corpus/test2
[add] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/test/data/variable_expander/fuzzer_corpus/test3
[add] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/tools/variable_expander.cc
[add] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/tools/variable_expander.h
[add] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/tools/variable_expander_fuzzer.cc
[add] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/chromeos/tools/variable_expander_unittest.cc
[modify] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/components/policy/core/common/policy_map.cc
[modify] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/components/policy/core/common/policy_map.h
[modify] https://crrev.com/09c943a7e347b831d53f02b426d8e9554b70a045/components/policy/resources/policy_templates.json

Project Member

Comment 9 by bugdroid1@chromium.org, Apr 17 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ead3110f47a6112c5bb20c08dbe16c1e66446788

commit ead3110f47a6112c5bb20c08dbe16c1e66446788
Author: Lutz Justen <ljusten@chromium.org>
Date: Mon Apr 16 16:07:32 2018

Clean up VariableExpander

Removes unnecessary SetVariable method (can use constructor). Documents usage.

BUG= chromium:829279 
TEST=Tryjobs

Change-Id: I44ac2f93cd65fcd2e36814c659956fbdb0dc8277
Reviewed-on: https://chromium-review.googlesource.com/1013937
Reviewed-by: Dan Erat <derat@chromium.org>
Commit-Queue: Lutz Justen <ljusten@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550983}
[modify] https://crrev.com/ead3110f47a6112c5bb20c08dbe16c1e66446788/chrome/browser/chromeos/policy/active_directory_policy_manager.cc
[modify] https://crrev.com/ead3110f47a6112c5bb20c08dbe16c1e66446788/chromeos/tools/variable_expander.cc
[modify] https://crrev.com/ead3110f47a6112c5bb20c08dbe16c1e66446788/chromeos/tools/variable_expander.h
[modify] https://crrev.com/ead3110f47a6112c5bb20c08dbe16c1e66446788/chromeos/tools/variable_expander_unittest.cc

Labels: Merge-Request-67
Would like to merge CL:1001576 to M67. It affects Active Directory managed Chromebooks only, so the affected user base is very small. We need this in M67 to move forward with a lighthouse customer. Thanks!

Sorry for the late-ish notice, I hadn't realized I missed M67 by one revision!

Project Member

Comment 11 by sheriffbot@chromium.org, Apr 27 2018

Labels: -Merge-Request-67 Merge-Review-67 Hotlist-Merge-Review
This bug requires manual review: M67 has already been promoted to the beta branch, so this requires manual review
Please contact the milestone owner if you have questions.
Owners: cmasso@(Android), cmasso@(iOS), kbleicher@(ChromeOS), govind@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Pls apply appropriate OSs label. Thank you.
Labels: OS-Chrome
New feature or a M67 bug regression?  A number of CLs included here; please advise for M67 necessity.
It's a single CL. See comment #10.
Thanks.  Still not clear if this was due to a bug introduced in M67 or a feature / change being made for a limited audience.  Impact if delayed for M68?
It's a feature requested by a large customer. The customer is planning to start rolling out Chromebooks in stores in June (M67 stable launch). If this feature is delayed for M68, they won't be able to print, which would be a major blocker for them.
Labels: -Merge-Review-67 Merge-Rejected-67
We don't add features post branch... And have a feature review process to ensure this doesn't come as a surprise post-branch.  Rejecting as a result; please email chromeos-tpms@ if need to escalate. Thx
Labels: -Merge-Rejected-67 Merge-Approved-67
Approving merge for M-67 given the explanations forwarded via email (scope, impact).  Thanks
Project Member

Comment 20 by sheriffbot@chromium.org, May 7 2018

Cc: kbleicher@chromium.org
This issue has been approved for a merge. Please merge the fix to any appropriate branches as soon as possible!

If all merges have been completed, please remove any remaining Merge-Approved labels from this issue.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 21 by bugdroid1@chromium.org, May 8 2018

Labels: -merge-approved-67 merge-merged-3396
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/48c92abf24c295f8d5436f0cbece2ae048653010

commit 48c92abf24c295f8d5436f0cbece2ae048653010
Author: Lutz Justen <ljusten@chromium.org>
Date: Tue May 08 09:10:42 2018

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-Original-Commit-Position: refs/heads/master@{#550466}(cherry picked from commit 09c943a7e347b831d53f02b426d8e9554b70a045)
Reviewed-on: https://chromium-review.googlesource.com/1049066
Reviewed-by: Lutz Justen <ljusten@chromium.org>
Cr-Commit-Position: refs/branch-heads/3396@{#514}
Cr-Branched-From: 9ef2aa869bc7bc0c089e255d698cca6e47d6b038-refs/heads/master@{#550428}
[modify] https://crrev.com/48c92abf24c295f8d5436f0cbece2ae048653010/chrome/browser/chromeos/policy/active_directory_policy_manager.cc
[modify] https://crrev.com/48c92abf24c295f8d5436f0cbece2ae048653010/chrome/browser/chromeos/policy/active_directory_policy_manager.h
[modify] https://crrev.com/48c92abf24c295f8d5436f0cbece2ae048653010/chromeos/BUILD.gn
[add] https://crrev.com/48c92abf24c295f8d5436f0cbece2ae048653010/chromeos/test/data/variable_expander/fuzzer.dict
[add] https://crrev.com/48c92abf24c295f8d5436f0cbece2ae048653010/chromeos/test/data/variable_expander/fuzzer_corpus/test1
[add] https://crrev.com/48c92abf24c295f8d5436f0cbece2ae048653010/chromeos/test/data/variable_expander/fuzzer_corpus/test2
[add] https://crrev.com/48c92abf24c295f8d5436f0cbece2ae048653010/chromeos/test/data/variable_expander/fuzzer_corpus/test3
[add] https://crrev.com/48c92abf24c295f8d5436f0cbece2ae048653010/chromeos/tools/variable_expander.cc
[add] https://crrev.com/48c92abf24c295f8d5436f0cbece2ae048653010/chromeos/tools/variable_expander.h
[add] https://crrev.com/48c92abf24c295f8d5436f0cbece2ae048653010/chromeos/tools/variable_expander_fuzzer.cc
[add] https://crrev.com/48c92abf24c295f8d5436f0cbece2ae048653010/chromeos/tools/variable_expander_unittest.cc
[modify] https://crrev.com/48c92abf24c295f8d5436f0cbece2ae048653010/components/policy/core/common/policy_map.cc
[modify] https://crrev.com/48c92abf24c295f8d5436f0cbece2ae048653010/components/policy/core/common/policy_map.h
[modify] https://crrev.com/48c92abf24c295f8d5436f0cbece2ae048653010/components/policy/resources/policy_templates.json

Status: Verified (was: Fixed)
Verified fixed. The Native Printing policy in Active Directory GPO is configured with '${machine_name}' variable (see screenshot 1). The device name shows up on chrome://policy under NativePrinters (see screenshot 2). Also verified with substrings, e.g. ${machine_name,6,4} = 4 chars from pos 6.

Chrome OS: 10575.32.0
Chrome: 67.0.3396.41
Device: Robo360

Screenshot from 2018-05-09 12-05-42.png
10.9 KB View Download
Screenshot 2018-05-09 at 11.54.07 AM.png
93.1 KB View Download

Sign in to add a comment