New issue
Advanced search Search tips

Issue 829328 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jul 5
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Feature



Sign in to add a comment

ADMX: Make text fields multi-line

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

Issue description

Long JSON blobs are hard to edit in the GPO editor since the input is single-line (see e.g. 'ARCPolicy' policy resp. 'Configure ARC' in GPO editor). One has to manually create a single-line JSON blob.

Try using multiline text input fields in the ADMX generator (admx_writer.py, _AddStringPolicy).
 
Labels: -Type-Bug Type-Feature

Comment 2 by olsen@google.com, Apr 6 2018

Owner: olsen@chromium.org
Labels: Pri-1
Project Member

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

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

commit 238c73fdf6322dc703e42b794f1622e3fcfc94cf
Author: A Olsen <olsen@chromium.org>
Date: Fri Apr 27 19:22:49 2018

authpolicy: Add support for REG_MULTI_SZ (multi-strings) in preg_parser

Chrome OS ADMX policies right now only support single line strings. No
matter how long or complex a JSON dict or a certificate is, it has to
be squeezed onto a single line before it can be entered into the
administrator control panel.
To make an admin's life easier, we will add support for multiple-line
strings, which can be pasted into multiple-line text boxes. Internally,
these are of windows type REG_MULTI_SZ, which is a null-delimited list
of strings.
When parsing, we replace the nulls separating each line with newlines,
so they are just multiline strings again when they arrive at the JSON
reader.

Add a unit test to make sure that null-delimited string-lists are
transformed into a single string with multiple lines by preg_parser.

Add another unit test to make sure that strings with multiple lines
are handled as we expect by the JSON reader.

BUG= chromium:829328 
TEST=Unit tests

Change-Id: I20a8ffdbc0484660037047fc3b863be13407707d
Reviewed-on: https://chromium-review.googlesource.com/1028014
Commit-Ready: A Olsen <olsen@chromium.org>
Tested-by: A Olsen <olsen@chromium.org>
Reviewed-by: Lutz Justen <ljusten@chromium.org>

[modify] https://crrev.com/238c73fdf6322dc703e42b794f1622e3fcfc94cf/authpolicy/policy/testdata/registry.pol
[modify] https://crrev.com/238c73fdf6322dc703e42b794f1622e3fcfc94cf/authpolicy/policy/preg_parser_unittest.cc
[modify] https://crrev.com/238c73fdf6322dc703e42b794f1622e3fcfc94cf/authpolicy/policy/preg_policy_encoder_unittest.cc
[modify] https://crrev.com/238c73fdf6322dc703e42b794f1622e3fcfc94cf/authpolicy/policy/preg_policy_writer.cc
[modify] https://crrev.com/238c73fdf6322dc703e42b794f1622e3fcfc94cf/authpolicy/policy/preg_parser.cc
[modify] https://crrev.com/238c73fdf6322dc703e42b794f1622e3fcfc94cf/authpolicy/policy/preg_policy_writer.h

Comment 5 by olsen@chromium.org, May 14 2018

This has turned out to be a bigger change than expected -

The data structure used by single-line textboxes (REG_SZ) is not 100% compatible with the data structure used by multi-line textboxes (REG_MULTI_SZ). The parser we use can handle whichever one ends up written in the .POL file, and the GPO editor doesn't crash if it finds the wrong one, but it won't display a single-line value in a multi-line textbox (and it only displays the first line of a multi-line value in a single-line textbox).

The best solution seems to be to show both single-line and multi-line textboxes side-by-side for a time, in case admins have stored a single-line value (which would otherwise be hidden), and then eventually to only show multi-line textboxes going forward.
Project Member

Comment 6 by bugdroid1@chromium.org, May 15 2018

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

commit 9f9c2c76d35ed8c00f992a973f301f727fb92cd6
Author: A Olsen <olsen@chromium.org>
Date: Tue May 15 15:40:39 2018

Use multiline text boxes in Chrome OS ADML

Right now we use only single-line textboxes. It is difficult for admins
to make a large JSON dict fit into a single line textbox, so this change
displays a multiline textbox instead in the following situations:
- Only in Chrome OS policies - not for Windows. (We could also turn this
  on for windows once we have checked for side effects.)
- Whenever an policy of type 'dict' or 'external' is expected.
- Whenever a policy of type 'string' that is actually JSON is expected.

As of this change, we will also still show a single-line textbox along
with the multiline, so that admins can still see the old single-line
value, since the two types of textboxes aren't completely compatible.
Eventually, we can stop showing the single-line textboxes.
See the attached bug for more information.

Also: Show more example values in help-text -
- for dicts and external, not just for list + string.

Bug:  829328 
Change-Id: Ic095d0e54dd324437dcfe89ef60c34a31f8ae16b
Reviewed-on: https://chromium-review.googlesource.com/1007082
Commit-Queue: A Olsen <olsen@chromium.org>
Reviewed-by: Lutz Justen <ljusten@chromium.org>
Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558715}
[modify] https://crrev.com/9f9c2c76d35ed8c00f992a973f301f727fb92cd6/components/policy/resources/policy_templates.json
[modify] https://crrev.com/9f9c2c76d35ed8c00f992a973f301f727fb92cd6/components/policy/tools/template_writers/writers/adml_writer.py
[modify] https://crrev.com/9f9c2c76d35ed8c00f992a973f301f727fb92cd6/components/policy/tools/template_writers/writers/adml_writer_unittest.py
[modify] https://crrev.com/9f9c2c76d35ed8c00f992a973f301f727fb92cd6/components/policy/tools/template_writers/writers/admx_writer.py
[modify] https://crrev.com/9f9c2c76d35ed8c00f992a973f301f727fb92cd6/components/policy/tools/template_writers/writers/admx_writer_unittest.py
[modify] https://crrev.com/9f9c2c76d35ed8c00f992a973f301f727fb92cd6/components/policy/tools/template_writers/writers/chromeos_adml_writer.py
[modify] https://crrev.com/9f9c2c76d35ed8c00f992a973f301f727fb92cd6/components/policy/tools/template_writers/writers/chromeos_adml_writer_unittest.py
[modify] https://crrev.com/9f9c2c76d35ed8c00f992a973f301f727fb92cd6/components/policy/tools/template_writers/writers/chromeos_admx_writer.py
[modify] https://crrev.com/9f9c2c76d35ed8c00f992a973f301f727fb92cd6/components/policy/tools/template_writers/writers/chromeos_admx_writer_unittest.py

Status: Fixed (was: Assigned)

Sign in to add a comment