Don't raise InvalidScope exception when do_raise=False
In the Enforcer.enforce() method there is boolean parameter do_raise.
When it is set to False, enforce() method should return True/False as an
enforcement result and not raise exception. It works like that with
PolicyNotAuthorized exception but since some time this method can also
raise InvalidScope exception and in such case behaviour was different.
This patch changes that behaviour so InvalidScope exception will also
not be raised when do_raise=False.
Reviewed: https:/ /review. opendev. org/c/openstack /oslo.policy/ +/834222 /opendev. org/openstack/ oslo.policy/ commit/ 9bc1783400f9960 b7132bf631c690a 98fbfc8066
Committed: https:/
Submitter: "Zuul (22348)"
Branch: master
commit 9bc1783400f9960 b7132bf631c690a 98fbfc8066
Author: Slawek Kaplonski <email address hidden>
Date: Thu Mar 17 20:35:45 2022 +0100
Don't raise InvalidScope exception when do_raise=False
In the Enforcer.enforce() method there is boolean parameter do_raise. thorized exception but since some time this method can also
When it is set to False, enforce() method should return True/False as an
enforcement result and not raise exception. It works like that with
PolicyNotAu
raise InvalidScope exception and in such case behaviour was different.
This patch changes that behaviour so InvalidScope exception will also
not be raised when do_raise=False.
Closes-bug: #1965315 4c69698e1be42ad ac28bbfe72a
Change-Id: I37fd682ffa9d6f