Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9fb9dfc6
authored
Jun 06, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: allow arbitrary GroupProfile.org_id values for admin
parent
240e00f7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
circle/dashboard/forms.py
+10
-7
circle/dashboard/views.py
+1
-0
No files found.
circle/dashboard/forms.py
View file @
9fb9dfc6
...
...
@@ -359,14 +359,17 @@ class GroupProfileUpdateForm(forms.ModelForm):
def
__init__
(
self
,
*
args
,
**
kwargs
):
new_groups
=
kwargs
.
pop
(
'new_groups'
,
None
)
superuser
=
kwargs
.
pop
(
'superuser'
,
False
)
super
(
GroupProfileUpdateForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
choices
=
[(
''
,
'--'
)]
if
new_groups
:
choices
+=
[(
g
,
g
)
for
g
in
new_groups
if
len
(
g
)
<=
64
]
self
.
fields
[
'org_id'
]
=
forms
.
ChoiceField
(
choices
=
choices
,
required
=
False
,
label
=
_
(
'Directory identifier'
))
if
not
new_groups
:
self
.
fields
[
'org_id'
]
.
widget
=
HiddenInput
()
if
not
superuser
:
choices
=
[(
''
,
'--'
)]
if
new_groups
:
choices
+=
[(
g
,
g
)
for
g
in
new_groups
if
len
(
g
)
<=
64
]
self
.
fields
[
'org_id'
]
=
forms
.
ChoiceField
(
choices
=
choices
,
required
=
False
,
label
=
_
(
'Directory identifier'
))
if
not
new_groups
:
self
.
fields
[
'org_id'
]
.
widget
=
HiddenInput
()
self
.
fields
[
'description'
]
.
widget
=
forms
.
Textarea
(
attrs
=
{
'rows'
:
3
})
@property
...
...
circle/dashboard/views.py
View file @
9fb9dfc6
...
...
@@ -1646,6 +1646,7 @@ class GroupProfileUpdate(GroupCodeMixin, LoginRequiredMixin, UpdateView):
kwargs
[
'instance'
]
=
instance
kwargs
[
'new_groups'
]
=
cls
.
get_available_group_codes
(
request
,
instance
.
org_id
)
kwargs
[
'superuser'
]
=
request
.
user
.
is_superuser
return
cls
.
form_class
(
*
args
,
**
kwargs
)
def
get
(
self
,
request
,
form
=
None
,
*
args
,
**
kwargs
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment