summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/util
diff options
context:
space:
mode:
authorNino Breuer2014-10-10 13:22:33 +0200
committerNino Breuer2014-10-10 13:22:33 +0200
commit994ccb035e237f1d5da5f6db2383cd3c87db55b8 (patch)
treeef7dc99a32a4a4645ea0eedda592e3738d637e86 /dozentenmodul/src/main/java/util
parentvorbereitung rechte korrigieren (diff)
downloadtutor-module-994ccb035e237f1d5da5f6db2383cd3c87db55b8.tar.gz
tutor-module-994ccb035e237f1d5da5f6db2383cd3c87db55b8.tar.xz
tutor-module-994ccb035e237f1d5da5f6db2383cd3c87db55b8.zip
added autocomplete and autocheck for setting new image rights
Diffstat (limited to 'dozentenmodul/src/main/java/util')
-rw-r--r--dozentenmodul/src/main/java/util/CheckIntegrity.java79
1 files changed, 53 insertions, 26 deletions
diff --git a/dozentenmodul/src/main/java/util/CheckIntegrity.java b/dozentenmodul/src/main/java/util/CheckIntegrity.java
index d87a8579..bb5becbd 100644
--- a/dozentenmodul/src/main/java/util/CheckIntegrity.java
+++ b/dozentenmodul/src/main/java/util/CheckIntegrity.java
@@ -2,46 +2,73 @@ package util;
public class CheckIntegrity {
- private static boolean isFine = false;
+ //private static boolean isFine = false;
- // integrety check on permissions put by user
- public static boolean[] isIntegre(boolean isRead, boolean isWrite,
- boolean isLink, boolean isAdmin) {
+ // integrity check on permissions put by user
+ public static boolean[] isIntegre(boolean isRead, boolean isWrite,boolean isLink, boolean isAdmin)
+ {
+
// boolean array for the correct result values
boolean[] rights = new boolean[4];
rights[0] = isRead;
rights[1] = isWrite;
rights[2] = isLink;
rights[3] = isAdmin;
+
+ System.out.println("*****************************");
+ System.out.println(isRead+" "+isWrite+" "+isLink+" "+isAdmin);
+
- // do all checks and only change wrong settings
- if (isAdmin == true) {
- // set true for everything
+ if(isRead) //if read is allowed, only read is allowed
+ {
+ rights[0] = true; //read allowed
+ }
+ else //if read is not allowed, nothing is allowed
+ {
+ rights[0] = false;
+ rights[1] = false;
+ rights[2] = false;
+ rights[3] = false;
+ }
+
+ if(isWrite) //if write was selected
+ {
+ rights[0] = true;
+ rights[1] = true;
+ }
+ else //if write was unselected
+ {
+ //rights[0] = false;
+ rights[1] = false;
+ }
+
+ if(isLink) //if link was selected, read and link are allowed
+ {
+ rights[0] = true;
+ rights[2] = true;
+ }
+ else //if link is unselected, link is not allowed
+ {
+ rights[2] = false;
+ }
+
+ if(isAdmin) //if admin is selected, anything is allowed
+ {
rights[0] = true;
rights[1] = true;
rights[2] = true;
rights[3] = true;
- return rights;
- } else {
- if(isRead == false){
- //if user may not read, then he may not do anything
- rights[0] = false;
- rights[1] = false;
- rights[2] = false;
- rights[3] = false;
- }
- if (isWrite == true) {
- // if user can write, then he must also be allowed to read
- rights[0] = true;
- }
-
- if (isLink == true) {
- // if user may link, then he may also read
-
- }
}
-
+ else //if admin is unselected, admin is not allowed
+ {
+ rights[3] = false;
+ }
+
+ System.out.println(">-------------<");
+ System.out.println(rights[0]+" "+rights[1]+" "+rights[2]+" "+rights[3]);
+
return rights;
+
}
}