Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
d4ba749c
Commit
d4ba749c
authored
Jan 11, 2013
by
Kostas Papadimitriou
Browse files
Helper api method to retrieve existing userids
parent
903bb385
Changes
1
Hide whitespace changes
Inline
Side-by-side
snf-cyclades-app/synnefo/api/util.py
View file @
d4ba749c
...
...
@@ -547,3 +547,23 @@ def get_pool_table(res_type):
return
MacPrefixPoolTable
else
:
raise
Exception
(
"Unknown resource type"
)
def
get_existing_users
():
"""
Retrieve user ids stored in cyclades user agnostic models.
"""
# also check PublicKeys a user with no servers/networks exist
from
synnefo.ui.userdata.models
import
PublicKeyPair
from
synnefo.db.models
import
VirtualMachine
,
Network
keypairusernames
=
PublicKeyPair
.
objects
.
filter
().
values_list
(
'user'
,
flat
=
True
)
serverusernames
=
VirtualMachine
.
objects
.
filter
().
values_list
(
'userid'
,
flat
=
True
)
networkusernames
=
Network
.
objects
.
filter
().
values_list
(
'userid'
,
flat
=
True
)
return
set
(
list
(
keypairusernames
)
+
list
(
serverusernames
)
+
\
list
(
networkusernames
))
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