Fix policy function check error
Change in I8a346e55bb98e4e22e0c14a614c45d493d20feb4 to make POLICY_CHECK_FUNCTION a string rather than a function was incomplete. The case in horizon/tables/base.py is problematic in particular and results in raising the TypeError: 'str' object is not callable error. There is another instance that is not problematic, but is changed for consistency sake. Change-Id: Ifc616e322eb38ec7e5ac218f7f3c5ccec52e40f4 Closes-Bug: #1818292
This commit is contained in:
parent
bdf7e69222
commit
78de547871
@ -46,6 +46,7 @@ from horizon.tables.actions import BatchAction
|
||||
from horizon.tables.actions import FilterAction
|
||||
from horizon.tables.actions import LinkAction
|
||||
from horizon.utils import html
|
||||
from horizon.utils import settings as utils_settings
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -380,7 +381,7 @@ class Column(html.HTMLElement):
|
||||
if not self.policy_rules:
|
||||
return True
|
||||
|
||||
policy_check = getattr(settings, "POLICY_CHECK_FUNCTION", None)
|
||||
policy_check = utils_settings.import_setting("POLICY_CHECK_FUNCTION")
|
||||
|
||||
if policy_check:
|
||||
return policy_check(self.policy_rules, request)
|
||||
|
@ -12,18 +12,18 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from openstack_auth import utils
|
||||
|
||||
import horizon
|
||||
from horizon.utils import settings as utils_settings
|
||||
|
||||
|
||||
class Admin(horizon.Dashboard):
|
||||
name = _("Admin")
|
||||
slug = "admin"
|
||||
|
||||
if getattr(settings, 'POLICY_CHECK_FUNCTION', None):
|
||||
if utils_settings.import_setting("POLICY_CHECK_FUNCTION"):
|
||||
policy_rules = (('identity', 'admin_required'),
|
||||
('image', 'context_is_admin'),
|
||||
('volume', 'context_is_admin'),
|
||||
|
Loading…
Reference in New Issue
Block a user