java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml | 10 --
java/code/src/com/redhat/rhn/common/db/datasource/xml/test_queries.xml | 9 -
java/code/src/com/redhat/rhn/common/security/acl/Access.java | 42 --------
java/code/src/com/redhat/rhn/common/security/acl/test/AccessTest.java | 23 ----
java/code/webapp/WEB-INF/nav/system_detail.xml | 2
web/html/nav/system_detail.xml | 4
web/modules/rhn/RHN/Access/System.pm | 50
+---------
7 files changed, 8 insertions(+), 132 deletions(-)
New commits:
commit 45c88f3d002e3790c3295d397c3fe8f477bc52ce
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Sep 30 16:16:31 2011 +0200
Recent commit makes version_string_to_evr_array unused, dropping.
diff --git a/web/modules/rhn/RHN/Access/System.pm b/web/modules/rhn/RHN/Access/System.pm
index 9b6865a..05f00e3 100644
--- a/web/modules/rhn/RHN/Access/System.pm
+++ b/web/modules/rhn/RHN/Access/System.pm
@@ -139,17 +139,6 @@ sub org_has_proxies {
return 0;
}
-# Given a string of the form 'version-release(:epoch)', return an
-# array of (epoch, version, release)
-sub version_string_to_evr_array {
- my $version = shift;
-
- my @vre = split(/[-:]/, $version);
- my @target_evr = ((exists $vre[2] ? $vre[2] : '0'), $vre[0], $vre[1]);
-
- return @target_evr;
-}
-
sub package_available_to_system {
my $pxt = shift;
my $package_name = shift;
commit 5b6de23a086e4c1f1510f3035ab355a582bbcc6c
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Sep 30 16:14:47 2011 +0200
Removing make_server_proxy query as it is no longer used.
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/test_queries.xml
b/java/code/src/com/redhat/rhn/common/db/datasource/xml/test_queries.xml
index 30b6efb..14c068f 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/test_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/test_queries.xml
@@ -331,15 +331,6 @@ VALUES (:server_id,
</query>
</mode>
-<write-mode name="make_server_proxy">
- <query params="server_id, evr_id">
-INSERT
- INTO rhnProxyInfo
- (server_id, proxy_evr_id)
-VALUES (:server_id, :evr_id)
- </query>
-</write-mode>
-
<write-mode name="ready_errata_cache_queue">
<query params="org_id, server_count, processed">
INSERT
commit f035523eadd7ca4815cdbffbd50474d5829fffd4
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Sep 30 16:13:57 2011 +0200
Removing org_proxy_servers_evr query as it is no longer used.
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
b/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
index 94cd23f..2c93cb1 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
@@ -953,16 +953,6 @@ SELECT PI.server_id ID, S.name, TO_CHAR(Sinfo.checkin,
'YYYY-MM-DD HH24:MI:SS')
</query>
</mode>
-<mode name="org_proxy_servers_evr"
class="com.redhat.rhn.domain.rhnpackage.PackageEvr">
- <query params="org_id">
-SELECT PE.epoch, PE.version, PE.release
- FROM rhnServer S, rhnProxyInfo PI, rhnPackageEVR PE
- WHERE S.org_id = :org_id
- AND PI.server_id = S.id
- AND PI.proxy_evr_id = PE.id
- </query>
-</mode>
-
<mode name="proxy_path_for_server"
class="com.redhat.rhn.frontend.dto.ServerPath">
<query params="sid">
SELECT SP.proxy_server_id ID, S.name, (SP.position + 1) AS position, SP.hostname
commit eef7c8adeb01898ac93507b5418768101eead899
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Sep 30 16:12:28 2011 +0200
Removing proxy_evr_at_least, org_proxy_evr_at_least, aclOrgProxyEvrAtLeast as they are
no longer used.
diff --git a/java/code/src/com/redhat/rhn/common/security/acl/Access.java
b/java/code/src/com/redhat/rhn/common/security/acl/Access.java
index 69bcfa7..7827c3f 100644
--- a/java/code/src/com/redhat/rhn/common/security/acl/Access.java
+++ b/java/code/src/com/redhat/rhn/common/security/acl/Access.java
@@ -263,48 +263,6 @@ public class Access extends BaseHandler implements AclHandler {
}
/**
- * FIXME not implemented. Currently this method
- * is unimplemented and ALWAYS returns false
- * @param ctx Context Map to pass in
- * @param params Parameters to use to fetch from Context
- * @return true if access is granted, false otherwise
- */
- public boolean aclOrgProxyEvrAtLeast(Object ctx, String[] params) {
- Map map = (Map) ctx;
- User user = (User) map.get("user");
- String version = params[0];
-
- //Generate the EVR from the parameter string
- String[] temp = version.split("[:-]");
- PackageEvr paramEVR;
- if (temp.length > 2) {
- paramEVR = new PackageEvr(temp[2], temp[0], temp[1]);
- }
- else {
- paramEVR = new PackageEvr(null, temp[0], temp[1]);
- }
-
- //Get EVRs for each proxy server in this org
- SelectMode m = ModeFactory.getMode("System_queries",
- "org_proxy_servers_evr");
- Map queryParams = new HashMap();
- queryParams.put("org_id", user.getOrg().getId());
- Iterator i = m.execute(queryParams).iterator();
-
- //Loop through the dataresult and if one EVR is at least
- //equal to the parameter EVR
- while (i.hasNext()) {
- PackageEvr next = (PackageEvr) i.next();
- int j = next.compareTo(paramEVR);
- if (j >= 0) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
* Check that the current user has access to the probe suite.
* The id of the suite must be in the parameter <code>suite_id</code>
* @param ctx acl context
diff --git a/java/code/src/com/redhat/rhn/common/security/acl/test/AccessTest.java
b/java/code/src/com/redhat/rhn/common/security/acl/test/AccessTest.java
index be52d2f..a6d9479 100644
--- a/java/code/src/com/redhat/rhn/common/security/acl/test/AccessTest.java
+++ b/java/code/src/com/redhat/rhn/common/security/acl/test/AccessTest.java
@@ -235,29 +235,6 @@ public class AccessTest extends RhnBaseTestCase {
- public void testOrgProxyEvrAtLeast() throws Exception {
- Map context = new HashMap();
- User user = UserTestUtils.findNewUser("testUser",
"testOrg");
- context.put("user", user);
- String param = "org_proxy_evr_at_least(3.6-2)";
- String param2 = "org_proxy_evr_at_least(3.6-3)";
-
- Server server = ServerFactoryTest.createTestServer(user);
- PackageEvr evr = PackageEvrFactory.createPackageEvr(null, "3.6",
"2");
-
- WriteMode m = ModeFactory.
- getWriteMode("test_queries", "make_server_proxy");
- Map params = new HashMap();
- params.put("server_id", server.getId());
- params.put("evr_id", evr.getId());
- m.executeUpdate(params);
-
- boolean access = acl.evalAcl(context, param);
- assertTrue(access);
- access = acl.evalAcl(context, param2);
- assertFalse(access);
- }
-
public void testUnimplementedMethods() {
String[] methods = { "user_authenticated()" };
diff --git a/web/modules/rhn/RHN/Access/System.pm b/web/modules/rhn/RHN/Access/System.pm
index d197b8b..9b6865a 100644
--- a/web/modules/rhn/RHN/Access/System.pm
+++ b/web/modules/rhn/RHN/Access/System.pm
@@ -36,8 +36,6 @@ sub register_acl_handlers {
$acl->register_handler(system_kickstart_session_exists =>
\&kickstart_session_exists);
$acl->register_handler(system_packaging_type => \&system_packaging_type);
$acl->register_handler(system_profile_capable => \&system_profile_capable);
- $acl->register_handler(proxy_evr_at_least => \&proxy_evr_at_least);
- $acl->register_handler(org_proxy_evr_at_least => \&org_proxy_evr_at_least);
$acl->register_handler(org_has_proxies => \&org_has_proxies);
$acl->register_handler(package_available => \&package_available_to_system);
$acl->register_handler(action_pending_named => \&action_pending_named);
@@ -127,48 +125,6 @@ sub system_profile_capable {
return 0;
}
-# Returns true if system is a proxy, and it reports an evr in
-# rhnProxyInfo, and that evr is greater than or equal to the input
-sub proxy_evr_at_least {
- my $pxt = shift;
- my $version = shift;
-
- my $sid = $pxt->param('sid');
-
- return 0 unless $sid;
- return 0 unless $version;
-
- my @system_evr = RHN::Server->proxy_evr($sid);
- my @target_evr = version_string_to_evr_array($version);
-
- return 0 unless (@system_evr);
-
- return 1 if RHN::Package->vercmp(@system_evr, @target_evr) >= 0;
-
- return 0;
-}
-
-# Return true if the org has at least one registered proxy whose
-# version is greater than the provided version
-sub org_proxy_evr_at_least {
- my $pxt = shift;
- my $version = shift;
-
- my @target_evr = version_string_to_evr_array($version);
-
- my $ds = new RHN::DataSource::System (-mode => 'org_proxy_servers');
- my $data = $ds->execute_query(-org_id => $pxt->user->org_id);
-
- foreach my $row (@{$data}) {
- my @system_evr = RHN::Server->proxy_evr($row->{ID});
-
- next unless (@system_evr);
- return 1 if RHN::Package->vercmp(@system_evr, @target_evr) >= 0;
- }
-
- return 0;
-}
-
# Return true if the org has at least one registered proxy
sub org_has_proxies {
my $pxt = shift;
commit 90b5efeb9e4d936048ee6bae6f4baad24726ebb0
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Sep 30 16:09:43 2011 +0200
Remove proxy_evr_at_least ACLs -- all supported proxy versions are 3+.
diff --git a/java/code/webapp/WEB-INF/nav/system_detail.xml
b/java/code/webapp/WEB-INF/nav/system_detail.xml
index 23fa5f0..3faac54 100644
--- a/java/code/webapp/WEB-INF/nav/system_detail.xml
+++ b/java/code/webapp/WEB-INF/nav/system_detail.xml
@@ -10,7 +10,7 @@
<rhn-tab name="Connection"
url="/network/systems/details/connection.pxt"
acl="org_has_proxies()"/>
<rhn-tab name="Proxy" url="/network/systems/details/proxy.pxt"
acl="user_role(org_admin); system_feature(ftr_proxy_capable);
org_channel_family(rhn-proxy); child_channel_candidate(rhn-proxy); not
system_is_satellite(); not is_solaris();system_feature(ftr_kickstart) or
system_feature(ftr_snapshotting)">
<rhn-tab name="Activation"
url="/network/systems/details/proxy.pxt" />
- <rhn-tab name="Systems Using Proxy"
url="/network/systems/details/proxy-clients.pxt"
acl="system_is_proxy();proxy_evr_at_least(3.1-1)"/>
+ <rhn-tab name="Systems Using Proxy"
url="/network/systems/details/proxy-clients.pxt" acl="system_is_proxy()
"/>
</rhn-tab>
<rhn-tab name="Reactivation"
url="/network/systems/details/activation.pxt"
acl="system_feature(ftr_agent_smith)"/>
<rhn-tab name="Hardware">
diff --git a/web/html/nav/system_detail.xml b/web/html/nav/system_detail.xml
index ff54fb1..4ef88da 100644
--- a/web/html/nav/system_detail.xml
+++ b/web/html/nav/system_detail.xml
@@ -10,7 +10,7 @@
<rhn-tab name="Connection"
url="/network/systems/details/connection.pxt"
acl="org_has_proxies()"/>
<rhn-tab name="Proxy" url="/network/systems/details/proxy.pxt"
acl="user_role(org_admin); system_feature(ftr_proxy_capable);
org_channel_family(rhn-proxy); child_channel_candidate(rhn-proxy);
org_entitlement(rhn_provisioning); not system_is_satellite(); not
is_solaris();system_feature(ftr_kickstart) or system_feature(ftr_snapshotting)">
<rhn-tab name="Activation"
url="/network/systems/details/proxy.pxt" />
- <rhn-tab name="Systems Using Proxy"
url="/network/systems/details/proxy-clients.pxt"
acl="system_is_proxy();proxy_evr_at_least(3.1-1)"/>
+ <rhn-tab name="Systems Using Proxy"
url="/network/systems/details/proxy-clients.pxt"
acl="system_is_proxy()"/>
</rhn-tab>
<rhn-tab name="Reactivation"
url="/network/systems/details/activation.pxt"
acl="system_feature(ftr_agent_smith)"/>
<rhn-tab name="Hardware">
commit 65b271f615532d6a6d33eeeaff0fdda0b91db46a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Sep 30 16:08:19 2011 +0200
Make the pxt Connection acl match the java version -- new acl org_has_proxies.
diff --git a/web/html/nav/system_detail.xml b/web/html/nav/system_detail.xml
index b590f12..ff54fb1 100644
--- a/web/html/nav/system_detail.xml
+++ b/web/html/nav/system_detail.xml
@@ -7,7 +7,7 @@
<rhn-tab name="Remote Command"
acl="system_feature(ftr_remote_command)">
<rhn-tab-url>/network/systems/details/remote_commands.pxt</rhn-tab-url>
</rhn-tab>
- <rhn-tab name="Connection"
url="/network/systems/details/connection.pxt"
acl="org_proxy_evr_at_least(3.1-1)"/>
+ <rhn-tab name="Connection"
url="/network/systems/details/connection.pxt"
acl="org_has_proxies()"/>
<rhn-tab name="Proxy" url="/network/systems/details/proxy.pxt"
acl="user_role(org_admin); system_feature(ftr_proxy_capable);
org_channel_family(rhn-proxy); child_channel_candidate(rhn-proxy);
org_entitlement(rhn_provisioning); not system_is_satellite(); not
is_solaris();system_feature(ftr_kickstart) or system_feature(ftr_snapshotting)">
<rhn-tab name="Activation"
url="/network/systems/details/proxy.pxt" />
<rhn-tab name="Systems Using Proxy"
url="/network/systems/details/proxy-clients.pxt"
acl="system_is_proxy();proxy_evr_at_least(3.1-1)"/>
diff --git a/web/modules/rhn/RHN/Access/System.pm b/web/modules/rhn/RHN/Access/System.pm
index 4dde51f..d197b8b 100644
--- a/web/modules/rhn/RHN/Access/System.pm
+++ b/web/modules/rhn/RHN/Access/System.pm
@@ -38,6 +38,7 @@ sub register_acl_handlers {
$acl->register_handler(system_profile_capable => \&system_profile_capable);
$acl->register_handler(proxy_evr_at_least => \&proxy_evr_at_least);
$acl->register_handler(org_proxy_evr_at_least => \&org_proxy_evr_at_least);
+ $acl->register_handler(org_has_proxies => \&org_has_proxies);
$acl->register_handler(package_available => \&package_available_to_system);
$acl->register_handler(action_pending_named => \&action_pending_named);
$acl->register_handler(last_action_attempt_failed =>
\&last_action_attempt_failed);
@@ -168,6 +169,20 @@ sub org_proxy_evr_at_least {
return 0;
}
+# Return true if the org has at least one registered proxy
+sub org_has_proxies {
+ my $pxt = shift;
+
+ my $ds = new RHN::DataSource::System (-mode => 'org_proxy_servers');
+ my $data = $ds->execute_query(-org_id => $pxt->user->org_id);
+
+ if (@{$data}) {
+ return 1;
+ }
+
+ return 0;
+}
+
# Given a string of the form 'version-release(:epoch)', return an
# array of (epoch, version, release)
sub version_string_to_evr_array {