winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

ElevationRequirement for specific InstallModes

Open OfficialEsco opened this issue 3 years ago • 3 comments

Description of the new feature / enhancement

We've spotted a issue where Silent sometimes requires Administrator where SilentWithProgress does not, therefore we need a way to set the ElevationRequirement per InstallMode.

Affected Packages

  • https://github.com/microsoft/winget-pkgs/pull/56369
  • https://github.com/microsoft/winget-pkgs/pull/28914

Proposed technical implementation details

I don't know of a clean way of implementing it into the Schema

OfficialEsco avatar Apr 01 '22 16:04 OfficialEsco

I don't know of a clean way of implementing it into the Schema

I've thought a little on this -

ElevationRequirement:
  Silent:  <>
  SilentWithProgress: <>
  Interactive: <>

To avoid this being a breaking change, the existing standard would have to be retained and just interpreted as if it applies to all the fields.

ElevationRequirement: <>

I figure these would do the trick -

"ElevationRequirementLevel": {
        "type": [
            "string",
            "null"
        ],
        "enum": [
            "elevationRequired",
            "elevationProhibited",
            "elevatesSelf"
        ],
        "description": "The installer's elevation requirement"
    }
"ElevationRequirement": {
        "oneOf": [
            {
                "$ref": "#/definitions/ElevationRequirementLevel"
            },
            {
                "type": [
                    "object",
                    "null"
                ],
                "properties": {
                    "Silent": {
                        "$ref": "#/definitions/ElevationRequirementLevel"
                    },
                    "SilentWithProgress": {
                        "$ref": "#/definitions/ElevationRequirementLevel"
                    },
                    "Interactive": {
                        "$ref": "#/definitions/ElevationRequirementLevel"
                    },
                }
            }
        ],
        "description": "The installer's elevation requirement"
    }

Trenly avatar Apr 19 '22 11:04 Trenly

How about making winget elevating when install,uninstall,upgrade commands are run

solomoncyj avatar May 19 '22 15:05 solomoncyj

How about making winget elevating when install,uninstall,upgrade commands are run

Why would they do that, that would break installers which prohibits elevation and winget would not work for users without administrator privileges.

OfficialEsco avatar May 19 '22 16:05 OfficialEsco