mirror of
https://github.com/m1k1o/neko-rooms.git
synced 2026-11-02 22:51:34 -06:00
wip: add install extensions to policy.
This commit is contained in:
@@ -46,7 +46,14 @@ func Generate(policies types.BrowserPolicyContent) (string, error) {
|
||||
|
||||
policiesTmpl["ExtensionInstallForcelist"] = ExtensionInstallForcelist
|
||||
policiesTmpl["ExtensionInstallAllowlist"] = ExtensionInstallAllowlist
|
||||
policiesTmpl["ExtensionInstallBlocklist"] = []interface{}{"*"}
|
||||
|
||||
if policies.InstallExtensions {
|
||||
// Allow installation of extensions
|
||||
policiesTmpl["ExtensionInstallBlocklist"] = []interface{}{}
|
||||
} else {
|
||||
// Disallow installation of extensions
|
||||
policiesTmpl["ExtensionInstallBlocklist"] = []interface{}{"*"}
|
||||
}
|
||||
|
||||
//
|
||||
// Developer Tools
|
||||
|
||||
@@ -35,6 +35,14 @@ func Parse(policiesJson string) (*types.BrowserPolicyContent, error) {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Install Extensions
|
||||
//
|
||||
|
||||
if val, ok := policiesTmpl["ExtensionInstallBlocklist"]; ok {
|
||||
policies.InstallExtensions = len(val.([]interface{})) == 0
|
||||
}
|
||||
|
||||
//
|
||||
// Developer Tools
|
||||
//
|
||||
|
||||
@@ -20,13 +20,22 @@ func Generate(policies types.BrowserPolicyContent) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
//
|
||||
// Install Extensions
|
||||
//
|
||||
|
||||
installationMode := "blocked"
|
||||
if policies.InstallExtensions {
|
||||
installationMode = "allowed"
|
||||
}
|
||||
|
||||
//
|
||||
// Extensions
|
||||
//
|
||||
|
||||
ExtensionSettings := map[string]interface{}{}
|
||||
ExtensionSettings["*"] = map[string]interface{}{
|
||||
"installation_mode": "blocked",
|
||||
"installation_mode": installationMode,
|
||||
}
|
||||
|
||||
for _, e := range policies.Extensions {
|
||||
|
||||
@@ -32,6 +32,13 @@ func Parse(policiesJson string) (*types.BrowserPolicyContent, error) {
|
||||
policies.Extensions = []types.BrowserPolicyExtension{}
|
||||
for id, val := range extensions.(map[string]interface{}) {
|
||||
if id == "*" {
|
||||
//
|
||||
// Install Extensions
|
||||
//
|
||||
|
||||
if val, ok := val.(map[string]interface{})["installation_mode"]; ok {
|
||||
policies.InstallExtensions = val.(string) == "allowed"
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user