Commit 28ee3823 by Szabolcs Gelencser Committed by Szabolcs Gelencsér

Extract role listing to settings.py

parent 9ccc63cf
...@@ -618,3 +618,10 @@ DEFAULT_LEASE_DELETE_SECONDS = 7200 ...@@ -618,3 +618,10 @@ DEFAULT_LEASE_DELETE_SECONDS = 7200
SESSIONHOOK_SHARED_SECRET = "verysecretmuchsecure" SESSIONHOOK_SHARED_SECRET = "verysecretmuchsecure"
IS_NET_OMISSION_SUPPORTED = False # in mitaka you must specify network at vm creation IS_NET_OMISSION_SUPPORTED = False # in mitaka you must specify network at vm creation
ROLES_SHOWN = [
"_member_",
"circle_admin",
"developer",
"researcher",
]
...@@ -580,7 +580,7 @@ class LeaseForm(forms.ModelForm): ...@@ -580,7 +580,7 @@ class LeaseForm(forms.ModelForm):
if roles: if roles:
self.fields['roles'].choices = ( self.fields['roles'].choices = (
(role.name, role.name) for role in roles (role, role) for role in roles
) )
if self.instance.id: if self.instance.id:
......
...@@ -444,7 +444,7 @@ class LeaseCreate(LoginRequiredMixin, PolicyMixin, ...@@ -444,7 +444,7 @@ class LeaseCreate(LoginRequiredMixin, PolicyMixin,
def get_form_kwargs(self): def get_form_kwargs(self):
from openstack_api import keystone from openstack_api import keystone
kwargs = super(LeaseCreate, self).get_form_kwargs() kwargs = super(LeaseCreate, self).get_form_kwargs()
kwargs['roles'] = keystone.role_list(self.request) kwargs['roles'] = settings.ROLES_SHOWN
return kwargs return kwargs
...@@ -462,7 +462,7 @@ class LeaseDetail(LoginRequiredMixin, PolicyMixin, ...@@ -462,7 +462,7 @@ class LeaseDetail(LoginRequiredMixin, PolicyMixin,
def get_form_kwargs(self): def get_form_kwargs(self):
from openstack_api import keystone from openstack_api import keystone
kwargs = super(LeaseDetail, self).get_form_kwargs() kwargs = super(LeaseDetail, self).get_form_kwargs()
kwargs['roles'] = keystone.role_list(self.request) kwargs['roles'] = settings.ROLES_SHOWN
return kwargs return kwargs
def get_context_data(self, *args, **kwargs): def get_context_data(self, *args, **kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment