winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

SourcePolicy.h (1273B)


      1 // Copyright (c) Microsoft Corporation.
      2 // Licensed under the MIT License.
      3 #pragma once
      4 #include "SourceList.h"
      5 #include <winget/GroupPolicy.h>
      6 
      7 #include <string_view>
      8 
      9 
     10 namespace AppInstaller::Repository
     11 {
     12     // Checks whether the Group Policy allows this user source.
     13     // If it does it returns None, otherwise it returns which policy is blocking it.
     14     // Note that this applies to user sources that are being added as well as user sources
     15     // that already existed when the Group Policy came into effect.
     16     Settings::TogglePolicy::Policy GetPolicyBlockingUserSource(std::string_view name, std::string_view type, std::string_view arg, bool isTombstone);
     17 
     18     // Helper that converts the result of GetPolicyBlockingUserSource into a bool.
     19     bool IsUserSourceAllowedByPolicy(std::string_view name, std::string_view type, std::string_view arg, bool isTombstone);
     20 
     21     // Determines if a well known source is enabled; if onlyExplicit is true, it must be explicitly enabled by group policy.
     22     bool IsWellKnownSourceEnabled(WellKnownSource source, bool onlyExplicit = false);
     23 
     24     // Checks that the specified source is removable per policy; throwing if it is not.
     25     void EnsureSourceIsRemovable(const SourceDetailsInternal& source);
     26 }