From 85a7dd60bfb9632ecce47fff41a9c6d22ec6a970 Mon Sep 17 00:00:00 2001
From: Peter Hormanns <peter.hormanns@hostsharing.net>
Date: Fri, 24 Jun 2011 14:05:41 +0200
Subject: [PATCH] NullPointerException fuer Hostmaster im Queue-Modul

---
 hsarback/src/de/hsadmin/mods/user/UnixUser.java   |    6 +++---
 hsarback/src/de/hsadmin/core/qserv/QueueTask.java |    5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/hsarback/src/de/hsadmin/core/qserv/QueueTask.java b/hsarback/src/de/hsadmin/core/qserv/QueueTask.java
index da1c081..ff46f96 100644
--- a/hsarback/src/de/hsadmin/core/qserv/QueueTask.java
+++ b/hsarback/src/de/hsadmin/core/qserv/QueueTask.java
@@ -74,8 +74,9 @@
 	 */
 	@Override
 	public boolean isReadAllowedFor(UnixUser loginUser) {
-		return loginUser.hasPacAdminRoleFor(getUser().getPac())
-				|| loginUser.id() == getUser().id();
+		return loginUser.hasHostmasterRole()
+			|| loginUser.hasPacAdminRoleFor(getUser().getPac())
+			|| loginUser.id() == getUser().id();
 	}
 
 	/**
diff --git a/hsarback/src/de/hsadmin/mods/user/UnixUser.java b/hsarback/src/de/hsadmin/mods/user/UnixUser.java
index 4a85470..baf97a1 100644
--- a/hsarback/src/de/hsadmin/mods/user/UnixUser.java
+++ b/hsarback/src/de/hsadmin/mods/user/UnixUser.java
@@ -287,9 +287,9 @@
 	 * determines whether this user account has admin rights on the given pac
 	 */
 	public boolean hasPacAdminRoleFor(de.hsadmin.mods.pac.Pac pac) {
-		// TODO: hardcoded Hostsharing conventions
-		return pac.getName().equals(getName())
-				|| hasCustomerRoleFor(pac.getCustomer());
+		return pac != null && 
+			(pac.getName().equals(getName())
+				|| hasCustomerRoleFor(pac.getCustomer()) );
 	}
 
 	/**

--
Gitblit v1.9.1