"Fossies" - the Fresh Open Source Software Archive

Member "barbican-12.0.0/barbican/common/policies/transportkeys.py" (14 Apr 2021, 2132 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 "transportkeys.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 _READER = "role:reader"
   16 _SYSTEM_ADMIN = "role:admin and system_scope:all"
   17 
   18 rules = [
   19     policy.DocumentedRuleDefault(
   20         name='transport_key:get',
   21         check_str=f'rule:all_users or {_READER}',
   22         scope_types=['project', 'system'],
   23         description='Get a specific transport key.',
   24         operations=[
   25             {
   26                 'path': '/v1/transport_keys/{key-id}}',
   27                 'method': 'GET'
   28             }
   29         ]
   30     ),
   31     policy.DocumentedRuleDefault(
   32         name='transport_key:delete',
   33         check_str=f'{_SYSTEM_ADMIN}',
   34         scope_types=['system'],
   35         description='Delete a specific transport key.',
   36         operations=[
   37             {
   38                 'path': '/v1/transport_keys/{key-id}',
   39                 'method': 'DELETE'
   40             }
   41         ]
   42     ),
   43     policy.DocumentedRuleDefault(
   44         name='transport_keys:get',
   45         check_str=f'rule:all_users or {_READER}',
   46         scope_types=['project', 'system'],
   47         description='Get a list of all transport keys.',
   48         operations=[
   49             {
   50                 'path': '/v1/transport_keys',
   51                 'method': 'GET'
   52             }
   53         ]
   54     ),
   55     policy.DocumentedRuleDefault(
   56         name='transport_keys:post',
   57         check_str=f'{_SYSTEM_ADMIN}',
   58         scope_types=['system'],
   59         description='Create a new transport key.',
   60         operations=[
   61             {
   62                 'path': '/v1/transport_keys',
   63                 'method': 'POST'
   64             }
   65         ]
   66     ),
   67 
   68 ]
   69 
   70 
   71 def list_rules():
   72     return rules