mirror of
https://github.com/Yubico/yubiadmin.git
synced 2025-02-22 02:54:16 +01:00
Fix displaying users to delete.
This commit is contained in:
parent
bf8d639e10
commit
e7f61a98ab
@ -71,6 +71,7 @@ auth_config = FileConfig(
|
|||||||
('hsm_device', python_handler('YHSM_DEVICE', 'yhsm://localhost:5348')),
|
('hsm_device', python_handler('YHSM_DEVICE', 'yhsm://localhost:5348')),
|
||||||
('db_config', python_handler('DATABASE_CONFIGURATION',
|
('db_config', python_handler('DATABASE_CONFIGURATION',
|
||||||
'sqlite:///:memory:')),
|
'sqlite:///:memory:')),
|
||||||
|
('user_registration', python_handler('ENABLE_USER_REGISTRATION', True))
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -99,7 +100,14 @@ class SecurityForm(ConfigForm):
|
|||||||
'Allow Empty Passwords',
|
'Allow Empty Passwords',
|
||||||
description="""
|
description="""
|
||||||
Allow users with no password to log in without providing a password.
|
Allow users with no password to log in without providing a password.
|
||||||
When set to False, a user with no password will be unable to log in.
|
When not checked, a user with no password will be unable to log in.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
user_registration = BooleanField(
|
||||||
|
'Enable User Registration',
|
||||||
|
description="""
|
||||||
|
Allow users to register themselves using the YubiAuth client interface.
|
||||||
|
When checked, accounts can be created <a href="/yubiauth/ui/">Here</a>.
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
security_level = SelectField(
|
security_level = SelectField(
|
||||||
@ -326,9 +334,10 @@ class YubiAuthUsers(CollectionApp):
|
|||||||
'YubiKeys': ', '.join(user.yubikeys.keys())
|
'YubiKeys': ', '.join(user.yubikeys.keys())
|
||||||
}, users)
|
}, users)
|
||||||
|
|
||||||
def _select(self, ids):
|
def _labels(self, ids):
|
||||||
return self.auth.session.query(self.User.name, self.User.id) \
|
users = self.auth.session.query(self.User.name) \
|
||||||
.filter(self.User.id.in_(map(int, ids))).all()
|
.filter(self.User.id.in_(map(int, ids))).all()
|
||||||
|
return map(lambda x: x[0], users)
|
||||||
|
|
||||||
def _delete(self, ids):
|
def _delete(self, ids):
|
||||||
self.auth.session.query(self.User) \
|
self.auth.session.query(self.User) \
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<legend>Confirm deletion</legend>
|
<legend>Confirm deletion</legend>
|
||||||
<p>Are you sure you wish to delete the following {{ item_name | lower }}?</p>
|
<p>Are you sure you wish to delete the following {{ item_name | lower }}?</p>
|
||||||
<ul>
|
<ul>
|
||||||
{% for item in items %}
|
{% for label in labels %}
|
||||||
<li>{{ item.label }}</li>
|
<li>{{ label }}</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -136,8 +136,8 @@ class CollectionApp(App):
|
|||||||
def _get(self, offset=0, limit=None):
|
def _get(self, offset=0, limit=None):
|
||||||
return [{}]
|
return [{}]
|
||||||
|
|
||||||
def _select(self, ids):
|
def _labels(self, ids):
|
||||||
return [x for x in self._get() if x['id'] in ids]
|
return [x['label'] for x in self._get() if x['id'] in ids]
|
||||||
|
|
||||||
def _delete(self, ids):
|
def _delete(self, ids):
|
||||||
raise Exception('Not implemented!')
|
raise Exception('Not implemented!')
|
||||||
@ -181,8 +181,8 @@ class CollectionApp(App):
|
|||||||
|
|
||||||
def delete(self, request):
|
def delete(self, request):
|
||||||
ids = [x[5:] for x in request.params if request.params[x] == 'on']
|
ids = [x[5:] for x in request.params if request.params[x] == 'on']
|
||||||
items = self._select(ids)
|
labels = self._labels(ids)
|
||||||
return render('table_delete', ids=','.join(ids), items=items,
|
return render('table_delete', ids=','.join(ids), labels=labels,
|
||||||
item_name=self.item_name, base_url=self.base_url)
|
item_name=self.item_name, base_url=self.base_url)
|
||||||
|
|
||||||
def delete_confirm(self, request):
|
def delete_confirm(self, request):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user