Bug 1542556

Summary: The last Spacewalk admin can be deleted if it's not an org admin and is disabled
Product: [Community] Spacewalk Reporter: Laurence Rochfort <laurence.rochfort>
Component: ServerAssignee: Tomáš Kašpárek <tkasparek>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 2.7CC: jdostal
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-20 12:31:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1564160    

Description Laurence Rochfort 2018-02-06 14:58:44 UTC
Description of problem:
If the last Spacewalk admin has the organization admin role removed, and is then deactivated, it can then be deleted by an organization administrator in the same org.

This leaves Spacewalk with no admin accounts. It is then not possible to create a new Spacewalk admin account or grant the Spacewalk admin role to another user.

Version-Release number of selected component (if applicable):
All

How reproducible:
Web UI, spacecmd and xmlrpc

Steps to Reproduce:
Example from web UI:

Assume two users, sw_admin and org_admin, both in org1. 

sw_admin is both a Spacewalk admin and an org_admin for org1. 
org_admin is only an org admin for org1.

1. Login as org_admin
2. Remove Organization Administrator role from sw_admin
3. Deactivate sw_admin user
4. Delete sw_admin user

Actual results:
Last admin user is deleted.

Expected results:
Should be told it's not permissable to delete the last Spacewalk admin. This is the current behaviour if the account was active.

Comment 1 Jiří Dostál 2018-03-23 14:53:14 UTC
Resolved by https://github.com/spacewalkproject/spacewalk/pull/627
spacewalk.git
0b816e010a686a08504cc568c7a6be011d4ebe3f

Comment 2 Jiří Dostál 2018-03-26 12:16:26 UTC
Moving ON_QA

Comment 3 Jiří Dostál 2018-04-20 12:31:06 UTC
Spacewalk 2.8 has been released.
https://github.com/spacewalkproject/spacewalk/wiki/ReleaseNotes28