mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-28 14:07:47 -04:00
* policy: load the CLI policy file from an internal package The plugin and theme registries need to read the policy too, and internal packages cannot import package main. * registries: let the CLI policy turn the registries off With disable_registries set in /usr/share/dms/cli-policy.json or /etc/dms/cli-policy.json (the /etc file wins), the plugin and theme registries start without sources, so nothing is cloned or pulled. Installed plugins and themes keep working.
27 lines
826 B
Go
27 lines
826 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
|
|
"github.com/AvengeMedia/DankMaterialShell/core/internal/clipolicy"
|
|
)
|
|
|
|
func TestDefaultImmutablePolicyAllowsSyncButBlocksEnable(t *testing.T) {
|
|
var policyFile clipolicy.File
|
|
if err := json.Unmarshal(defaultCLIPolicyJSON, &policyFile); err != nil {
|
|
t.Fatalf("failed to parse embedded CLI policy: %v", err)
|
|
}
|
|
if policyFile.BlockedCommands == nil {
|
|
t.Fatal("embedded CLI policy has no blocked_commands")
|
|
}
|
|
|
|
blocked := normalizeBlockedCommands(*policyFile.BlockedCommands)
|
|
if !commandBlockedByPolicy("greeter enable", blocked) {
|
|
t.Fatal("expected greeter enable to remain blocked on immutable/image-based systems")
|
|
}
|
|
if commandBlockedByPolicy("greeter sync", blocked) {
|
|
t.Fatal("expected greeter sync to remain available on immutable/image-based systems")
|
|
}
|
|
}
|