From ee5fbad2545db1ea878aea5848fe5effef7d16a7 Mon Sep 17 00:00:00 2001
From: Purodha Blissenbach <purodha.blissenbach@hostsharing.net>
Date: Thu, 16 Aug 2012 12:48:07 +0200
Subject: [PATCH] Privileges added: super stupid implememtation allow everyone to to everything and that cannot be altered.

---
 hsarback/src/de/hsadmin/core/model/PrivilegesModuleImpl.java |   57 ++++++++++++++++++++++++++++
 hsarback/src/de/hsadmin/core/model/PrivilegesInterface.java  |   12 ++++++
 2 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/hsarback/src/de/hsadmin/core/model/PrivilegesInterface.java b/hsarback/src/de/hsadmin/core/model/PrivilegesInterface.java
new file mode 100644
index 0000000..c72b9a2
--- /dev/null
+++ b/hsarback/src/de/hsadmin/core/model/PrivilegesInterface.java
@@ -0,0 +1,12 @@
+package de.hsadmin.core.model;
+
+import de.hsadmin.mods.user.UnixUser;
+
+public interface PrivilegesInterface {
+
+	public boolean isAllowedToCreate( UnixUser user, AbstractEntity entity ) ;
+	public boolean isAllowedToSearch( UnixUser user, AbstractEntity entity ) ;
+	public boolean isAllowedToUpdate( UnixUser user, AbstractEntity orignalentity, AbstractEntity targetentity ) ;
+	public boolean isAllowedToDelete( UnixUser user, AbstractEntity entity ) ;
+	
+}
diff --git a/hsarback/src/de/hsadmin/core/model/PrivilegesModuleImpl.java b/hsarback/src/de/hsadmin/core/model/PrivilegesModuleImpl.java
new file mode 100644
index 0000000..8686274
--- /dev/null
+++ b/hsarback/src/de/hsadmin/core/model/PrivilegesModuleImpl.java
@@ -0,0 +1,57 @@
+package de.hsadmin.core.model;
+
+import java.util.List;
+
+import de.hsadmin.mods.user.UnixUser;
+
+public class PrivilegesModuleImpl extends AbstractModuleImpl implements PrivilegesInterface {
+
+	@Override
+	public AbstractEntity add(AbstractEntity newEntity) throws HSAdminException {
+		return super.add(newEntity);
+	}
+
+	@Override
+	public List<AbstractEntity> search(
+			Class<? extends AbstractEntity> entityClass, String condition,
+			String orderBy) throws HSAdminException {
+		return super.search(entityClass, condition, orderBy);
+	}
+
+	@Override
+	public AbstractEntity update(AbstractEntity existingEntity)
+			throws HSAdminException {
+		return super.update(existingEntity);
+	}
+
+	@Override
+	public void delete(AbstractEntity existingEntity) throws HSAdminException {
+		super.delete(existingEntity);
+	}
+
+	@Override
+	public boolean isAllowedToCreate(UnixUser user, AbstractEntity entity) {
+		// stupid generic implementation allowing everything.
+		return true;
+	}
+
+	@Override
+	public boolean isAllowedToSearch(UnixUser user, AbstractEntity entity) {
+		// stupid generic implementation allowing everything.
+		return true;
+	}
+
+	@Override
+	public boolean isAllowedToUpdate(UnixUser user,
+			AbstractEntity orignalentity, AbstractEntity targetentity) {
+		// stupid generic implementation allowing everything.
+		return true;
+	}
+
+	@Override
+	public boolean isAllowedToDelete(UnixUser user, AbstractEntity entity) {
+		// stupid generic implementation allowing everything.
+		return true;
+	}
+
+}

--
Gitblit v1.9.0-SNAPSHOT