logs.py (monasca-log-api-2.7.0) | : | logs.py (monasca-log-api-2.9.0) | ||
---|---|---|---|---|
skipping to change at line 15 | skipping to change at line 15 | |||
# a copy of the License at | # a copy of the License at | |||
# | # | |||
# http://www.apache.org/licenses/LICENSE-2.0 | # http://www.apache.org/licenses/LICENSE-2.0 | |||
# | # | |||
# Unless required by applicable law or agreed to in writing, software | # Unless required by applicable law or agreed to in writing, software | |||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | |||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | |||
# License for the specific language governing permissions and limitations | # License for the specific language governing permissions and limitations | |||
# under the License. | # under the License. | |||
from oslo_config import cfg | ||||
from oslo_policy import policy | from oslo_policy import policy | |||
from monasca_log_api.policies import AGENT_AUTHORIZED_ROLES | from monasca_log_api import policies | |||
from monasca_log_api.policies import DEFAULT_AUTHORIZED_ROLES | ||||
from monasca_log_api.policies import DELEGATE_AUTHORIZED_ROLES | DEFAULT_AUTHORIZED_ROLES = policies.roles_list_to_check_str( | |||
cfg.CONF.roles_middleware.default_roles) | ||||
AGENT_AUTHORIZED_ROLES = policies.roles_list_to_check_str( | ||||
cfg.CONF.roles_middleware.agent_roles) | ||||
DELEGATE_AUTHORIZED_ROLES = policies.roles_list_to_check_str( | ||||
cfg.CONF.roles_middleware.delegate_roles) | ||||
rules = [ | rules = [ | |||
policy.DocumentedRuleDefault( | policy.DocumentedRuleDefault( | |||
name='log_api:logs:post', | name='log_api:logs:post', | |||
check_str=' or '.join(filter(None, [AGENT_AUTHORIZED_ROLES, | check_str=' or '.join(filter(None, [AGENT_AUTHORIZED_ROLES, | |||
DEFAULT_AUTHORIZED_ROLES, | DEFAULT_AUTHORIZED_ROLES, | |||
DELEGATE_AUTHORIZED_ROLES])), | DELEGATE_AUTHORIZED_ROLES])), | |||
description='Logs post rule', | description='Logs post rule', | |||
operations=[ | operations=[ | |||
{'path': '/logs', 'method': 'POST'}, | {'path': '/logs', 'method': 'POST'}, | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 9 lines changed or added |