Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show disabled (locked) users #1296

Merged
merged 3 commits into from Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/tests.yml
Expand Up @@ -32,12 +32,13 @@ jobs:

unit_test:
name: Unit tests
container: fedorapython/fedora-python-tox:latest
steps:
- uses: actions/checkout@v3
- name: Mark the directory as safe for git
run: git config --global --add safe.directory $PWD
- name: Run tests
uses: fedora-python/tox-github-action@main
with:
tox_env: ${{ matrix.tox_env }}
run: tox -e ${{ matrix.tox_env }}
strategy:
matrix:
tox_env:
Expand Down
7 changes: 2 additions & 5 deletions Vagrantfile
Expand Up @@ -26,11 +26,8 @@ Vagrant.configure(2) do |config|
end

config.vm.define "noggin" do |noggin|
noggin.vm.box_url = "https://download.fedoraproject.org/pub/fedora/linux/releases/34/Cloud/x86_64/images/Fedora-Cloud-Base-Vagrant-34-1.2.x86_64.vagrant-libvirt.box"
noggin.vm.box = "f34-cloud-libvirt"
# We can't use F35 yet because of https://bugzilla.redhat.com/show_bug.cgi?id=2020278
#noggin.vm.box_url = "https://download.fedoraproject.org/pub/fedora/linux/releases/35/Cloud/x86_64/images/Fedora-Cloud-Base-Vagrant-35-1.2.x86_64.vagrant-libvirt.box"
#noggin.vm.box = "f35-cloud-libvirt"
noggin.vm.box_url = "https://download.fedoraproject.org/pub/fedora/linux/releases/38/Cloud/x86_64/images/Fedora-Cloud-Base-Vagrant-38-1.6.x86_64.vagrant-libvirt.box"
noggin.vm.box = "f38-cloud-libvirt"
noggin.vm.hostname = "noggin.noggin.test"

noggin.vm.synced_folder '.', '/vagrant', disabled: true
Expand Down
1 change: 1 addition & 0 deletions news/1210.bug
@@ -0,0 +1 @@
Don't show disabled (locked) users in Noggin
4 changes: 3 additions & 1 deletion noggin/controller/root.py
Expand Up @@ -86,7 +86,9 @@ def search_json(ipa):
if username:
users_ = [
User(u)
for u in ipa.user_find(username, fasuser=True, sizelimit=10)['result']
for u in ipa.user_find(
username, fasuser=True, o_nsaccountlock=False, sizelimit=10
)['result']
]

for user_ in users_:
Expand Down
5 changes: 4 additions & 1 deletion noggin/utility/controllers.py
Expand Up @@ -60,6 +60,9 @@ def group_or_404(ipa, groupname):

def user_or_404(ipa, username):
try:
return ipa.user_show(a_uid=username)['result']
user = ipa.user_show(a_uid=username)['result']
except python_freeipa.exceptions.NotFound:
abort(404)
if User(user).locked:
abort(404)
return user