orfeas_pam_dsl 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,50 @@
1
+ module PamDsl
2
+ # Registry for storing and retrieving policies
3
+ class Registry
4
+ attr_reader :policies
5
+
6
+ def initialize
7
+ @policies = {}
8
+ end
9
+
10
+ # Register a policy
11
+ def register(name, policy)
12
+ @policies[name.to_sym] = policy
13
+ end
14
+
15
+ # Get a policy by name
16
+ def get(name)
17
+ @policies[name.to_sym]
18
+ end
19
+
20
+ # Get all policies
21
+ def all
22
+ @policies.values
23
+ end
24
+
25
+ # Get all policy names
26
+ def names
27
+ @policies.keys
28
+ end
29
+
30
+ # Check if policy exists
31
+ def exists?(name)
32
+ @policies.key?(name.to_sym)
33
+ end
34
+
35
+ # Remove a policy
36
+ def remove(name)
37
+ @policies.delete(name.to_sym)
38
+ end
39
+
40
+ # Clear all policies
41
+ def clear
42
+ @policies.clear
43
+ end
44
+
45
+ # Count of registered policies
46
+ def count
47
+ @policies.count
48
+ end
49
+ end
50
+ end