Coverage for watcher/common/policies/base.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.8.2, created at 2025-06-17 12:22 +0000

1# Licensed under the Apache License, Version 2.0 (the "License"); you may 

2# not use this file except in compliance with the License. You may obtain 

3# a copy of the License at 

4# 

5# http://www.apache.org/licenses/LICENSE-2.0 

6# 

7# Unless required by applicable law or agreed to in writing, software 

8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 

9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 

10# License for the specific language governing permissions and limitations 

11# under the License. 

12 

13from oslo_policy import policy 

14 

15RULE_ADMIN_API = 'rule:admin_api' 

16ROLE_ADMIN_OR_ADMINISTRATOR = 'role:admin or role:administrator' 

17ALWAYS_DENY = '!' 

18 

19rules = [ 

20 policy.RuleDefault( 

21 name='admin_api', 

22 check_str=ROLE_ADMIN_OR_ADMINISTRATOR 

23 ), 

24 policy.RuleDefault( 

25 name='show_password', 

26 check_str=ALWAYS_DENY 

27 ) 

28] 

29 

30 

31def list_rules(): 

32 return rules