"Fossies" - the Fresh Open Source Software Archive

Member "barbican-12.0.0/barbican/common/policies/secretstores.py" (14 Apr 2021, 3177 Bytes) of package /linux/misc/openstack/barbican-12.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "secretstores.py" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 11.0.0_vs_12.0.0.

    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 
   13 from oslo_policy import policy
   14 
   15 
   16 _READER = "role:reader"
   17 
   18 rules = [
   19     policy.DocumentedRuleDefault(
   20         name='secretstores:get',
   21         check_str=f'rule:all_users or {_READER}',
   22         scope_types=['project', 'system'],
   23         description='Get list of available secret store backends.',
   24         operations=[
   25             {
   26                 'path': '/v1/secret-stores',
   27                 'method': 'GET'
   28             }
   29         ]
   30     ),
   31     policy.DocumentedRuleDefault(
   32         name='secretstores:get_global_default',
   33         check_str=f'rule:all_users or {_READER}',
   34         scope_types=['project', 'system'],
   35         description='Get a reference to the secret store that is used as ' +
   36                     'default secret store backend for the deployment.',
   37         operations=[
   38             {
   39                 'path': '/v1/secret-stores/global-default',
   40                 'method': 'GET'
   41             }
   42         ]
   43     ),
   44     policy.DocumentedRuleDefault(
   45         name='secretstores:get_preferred',
   46         check_str=f'rule:all_users or {_READER}',
   47         scope_types=['project', 'system'],
   48         description='Get a reference to the preferred secret store if ' +
   49                     'assigned previously.',
   50         operations=[
   51             {
   52                 'path': '/v1/secret-stores/preferred',
   53                 'method': 'GET'
   54             }
   55         ]
   56     ),
   57     policy.DocumentedRuleDefault(
   58         name='secretstore_preferred:post',
   59         check_str='rule:admin',
   60         scope_types=['project'],
   61         description='Set a secret store backend to be preferred store ' +
   62                     'backend for their project.',
   63         operations=[
   64             {
   65                 'path': '/v1/secret-stores/{ss-id}/preferred',
   66                 'method': 'POST'
   67             }
   68         ]
   69     ),
   70     policy.DocumentedRuleDefault(
   71         name='secretstore_preferred:delete',
   72         check_str='rule:admin',
   73         scope_types=['project'],
   74         description='Remove preferred secret store backend setting for ' +
   75                     'their project.',
   76         operations=[
   77             {
   78                 'path': '/v1/secret-stores/{ss-id}/preferred',
   79                 'method': 'DELETE'
   80             }
   81         ]
   82     ),
   83     policy.DocumentedRuleDefault(
   84         name='secretstore:get',
   85         check_str=f'rule:all_users or {_READER}',
   86         scope_types=['project', 'system'],
   87         description='Get details of secret store by its ID.',
   88         operations=[
   89             {
   90                 'path': '/v1/secret-stores/{ss-id}',
   91                 'method': 'GET'
   92             }
   93         ]
   94     ),
   95 ]
   96 
   97 
   98 def list_rules():
   99     return rules