2012-02-04 17:40:31 -06:00
|
|
|
# Copyright 2012 United States Government as represented by the
|
2011-07-03 20:55:00 -07:00
|
|
|
# Administrator of the National Aeronautics and Space Administration.
|
|
|
|
# All Rights Reserved.
|
|
|
|
#
|
2012-02-04 17:40:31 -06:00
|
|
|
# Copyright 2012 Nebula, Inc.
|
2011-07-03 20:55:00 -07:00
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
# not use this file except in compliance with the License. You may obtain
|
|
|
|
# a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
|
2021-11-22 13:42:29 +01:00
|
|
|
from django.conf import settings
|
2022-01-26 22:42:15 +09:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2012-03-22 23:18:59 +08:00
|
|
|
|
2011-10-31 11:31:05 -07:00
|
|
|
import horizon
|
2012-10-04 15:43:40 -07:00
|
|
|
|
2011-04-13 13:29:39 -05:00
|
|
|
|
2013-05-24 00:01:30 +08:00
|
|
|
class Info(horizon.Panel):
|
2014-07-03 01:35:38 +05:30
|
|
|
name = _("System Information")
|
2012-11-17 15:49:17 -08:00
|
|
|
slug = 'info'
|
2016-11-18 15:02:20 -07:00
|
|
|
policy_rules = (("compute", "context_is_admin"),
|
|
|
|
("volume", "context_is_admin"),
|
2017-11-28 21:12:02 +09:00
|
|
|
("network", "context_is_admin"),)
|
2021-11-22 13:42:29 +01:00
|
|
|
|
|
|
|
def allowed(self, context):
|
|
|
|
if (('compute' in settings.SYSTEM_SCOPE_SERVICES) !=
|
|
|
|
bool(context['request'].user.system_scoped)):
|
|
|
|
return False
|
|
|
|
return super().allowed(context)
|