Skip to content

Test: save file as admin #40592

@bpasero

Description

@bpasero

Refs: #1614

Complexity: 3

It is now possible to save a file as admin if the permissions are not sufficient to save it (you can NOT create new files or folders as admin currently). From the error message when saving fails, a new "Retry as Admin" option allows to do so.

image

Under the hood, the sudo-prompt module is leveraged to spawn the code CLI script with parameters to write to the target file that needs special permissions.

Note: on Windows, any file in the programs directory needs admin permissions and on other OS, for example /etc/hosts.

Verify:

  • you can save as admin and the contents are written to disk
  • errors are handled gracefully (e.g. cancelling the admin prompt)
  • Windows: you can even save "readonly" and/or "hidden" files and these properties are preserved (you can enable the properties from the first page of the properties dialog on a file). When saving readonly files, first pick the option to "Overwrite" from the error message and then "Overwrite as Admin"

Note: you will need to authenticate each time you save, we do not keep any admin process around.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions