Bug 814836

Summary: activationkey.listActivationKeys() returns all activation keys instead only visible to the user
Product: [Community] Spacewalk Reporter: Marcelo Moreira de Mello <mmello>
Component: APIAssignee: Tomas Lestach <tlestach>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.7CC: cperry, mmello, shughes
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 814838 (view as bug list) Environment:
Last Closed: 2012-11-01 16:17:40 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: 871344    
Attachments:
Description Flags
Reproducer script
none
patch to show only custom activation keys none

Description Marcelo Moreira de Mello 2012-04-20 19:53:12 UTC
Created attachment 579101 [details]
Reproducer script

Description of problem:
activationkey.listActivationKeys() returns all activation keys instead only visible for the user


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

How reproducible:
100%


Steps to Reproduce:
1. Use reproducer attached
2.
3.
  
Actual results:

Auto-generated activation keys are being listed when API method activationkey.listActivationKeys() is called


Expected results:

 Only the custom activation keys (not auto-generated) be displayed


Additional info:

theo $> python list-activationkeys.py 

Total ActivationKeys (5)
----------------------------------------
	key:	         1-rhel5-bare-metal-x86_64
	description:	 rhel5-bare-metal-x86_64
	usage_limit:	 0

	key:	         1-rhel4-vms-x86_64
	description:	 rhel4-vms-x86_64
	usage_limit:	 0

	key:	         1-rhel6-vms-x86_64
	description:	 rhel6-vms-x86_64
	usage_limit:	 0

	key:	         1-rhel5-vms-x86_64
	description:	 rhel5-vms-x86_64
	usage_limit:	 0

	key:	         1-rhel6-bare-metal-x86_64
	description:	 rhel6-bare-metal-x86_64
	usage_limit:	 0


Keys Excluded: (26)
********************************
	key:	         1-1f19381f55af5da152e62103ab85c66e
	description:	 Kickstart re-activation key for  .
	usage_limit:	 0

	key:	         1-fbdbf49c82ea03a20905388aae1253dd
	description:	 Kickstart re-activation key for  .
	usage_limit:	 0

	key:	         1-c8dc7bac55211e8c23e1d7577cbe91aa
	description:	 Automatically generated activation key.
	usage_limit:	 1

	key:	         re-1-36c7bceefdc191922839a43f43909236
	description:	 Reactivation key for serverA.domain-example.com.
	usage_limit:	 0

	key:	         1-0a09258b40d73e83cc078a07566b5696
	description:	 Automatically generated activation key.
	usage_limit:	 1

	key:	         re-1-9e4bc9a46aa789b1edd6521d02cda4c8
	description:	 Reactivation key for serverA-1.domain-example.com.
	usage_limit:	 0

	key:	         1-557da00c37e3b264e54051dbd6c7c674
	description:	 Automatically generated activation key.
	usage_limit:	 1

	key:	         re-1-c3d5324ad26e4e1e35235ba4896887cb
	description:	 Reactivation key for serverB.domain-example.com.
	usage_limit:	 0

	key:	         1-3bd2635254303d35fce4d86dd92216c6
	description:	 Automatically generated activation key.
	usage_limit:	 1

	key:	         re-1-66514ddef24b9109dd6fca7677bbc335
	description:	 Reactivation key for serverB.domain-example.com.
	usage_limit:	 0

	key:	         1-d57100ec86994b18547ebf8041f7ba07
	description:	 Automatically generated activation key.
	usage_limit:	 1

	key:	         re-1-285093340c4d1a2619c8e87fb01f4844
	description:	 Reactivation key for serverB.domain-example.com.
	usage_limit:	 0

	key:	         1-4f8373b4cd9e3a78c72da24ba745faff
	description:	 Automatically generated activation key.
	usage_limit:	 1

	key:	         re-1-8af05dcd5e9f23ed5934fa8abc60db4f
	description:	 Reactivation key for serverB.domain-example.com.
	usage_limit:	 0

	key:	         1-9a9e22754c6259e9fc9f4a18c38aa33b
	description:	 Chave de reativação do kickstart para  .
	usage_limit:	 0

	key:	         1-67f12964d3a05f1b9a0dca7e83a758bb
	description:	 Kickstart re-activation key for  .
	usage_limit:	 0

	key:	         1-db0245081ad701b676aeddaeddb96baa
	description:	 Kickstart re-activation key for  .
	usage_limit:	 0

	key:	         1-78c09592a5348e2928d291e47476fe3a
	description:	 Automatically generated activation key.
	usage_limit:	 1

	key:	         re-1-98a6ca7e5798ab7ac378985ba63b4877
	description:	 Reactivation key for serverB.domain-example.com.
	usage_limit:	 0

	key:	         1-53570e88999707d8824e3693496eb996
	description:	 Kickstart re-activation key for  .
	usage_limit:	 0

	key:	         1-4d5e4c9de4e43a90c72b6bc9412f5f2e
	description:	 Kickstart re-activation key for  .
	usage_limit:	 0

	key:	         re-1-3b732ee74a14884a29bb6c9c5c039fc9
	description:	 Kickstart re-activation key for dhcp235.domain-example.com.
	usage_limit:	 1

	key:	         1-faecd4441330ef69c57dd28716cb95de
	description:	 Automatically generated activation key.
	usage_limit:	 1

	key:	         re-1-dd0e97fa66924ee5552c95c9b6a27aae
	description:	 Reactivation key for serverA.domain-example.com.
	usage_limit:	 0

	key:	         1-ef829f4593a0e165c6a113a2855eb8ed
	description:	 Automatically generated activation key.
	usage_limit:	 1

	key:	         re-1-5b8e39f66b65056e7abf41c4252d2a89
	description:	 Reactivation key for serverB.domain-example.com.
	usage_limit:	 0

Comment 1 Shannon Hughes 2012-04-23 20:53:36 UTC
Created attachment 579690 [details]
patch to show only custom activation keys

adding patch that fixes the issue marcello is describing

Comment 2 Tomas Lestach 2012-04-24 09:38:56 UTC
I do not like the idea that we make a activation_keys_for_org query and then for each entry another hibernate query to load the activation key (in the attached patch).

Fixing ...
spacewalk.git: 03030a6b2c92ff046f0aa197c36ed063b803bba4

Comment 3 Tomas Lestach 2012-04-24 09:39:12 UTC
I do not like the idea that we make a activation_keys_for_org query and then for each entry another hibernate query to load the activation key (in the attached patch).

Fixing ...
spacewalk.git: 03030a6b2c92ff046f0aa197c36ed063b803bba4

Comment 5 Shannon Hughes 2012-04-24 11:51:40 UTC
tomas, agree, your commit is a much cleaner approach. thanks for looking at this.

Comment 6 Jan Pazdziora 2012-10-30 19:22:41 UTC
Moving ON_QA. Packages that address this bugzilla should now be available in yum repos at http://yum.spacewalkproject.org/nightly/

Comment 7 Jan Pazdziora 2012-11-01 16:17:40 UTC
Spacewalk 1.8 has been released: https://fedorahosted.org/spacewalk/wiki/ReleaseNotes18