diff options
Diffstat (limited to 'dozentenmodul/src/main/java/util/CheckIntegrity.java')
| -rw-r--r-- | dozentenmodul/src/main/java/util/CheckIntegrity.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/dozentenmodul/src/main/java/util/CheckIntegrity.java b/dozentenmodul/src/main/java/util/CheckIntegrity.java new file mode 100644 index 00000000..d87a8579 --- /dev/null +++ b/dozentenmodul/src/main/java/util/CheckIntegrity.java @@ -0,0 +1,47 @@ +package util; + +public class CheckIntegrity { + + private static boolean isFine = false; + + // integrety 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; + + // do all checks and only change wrong settings + if (isAdmin == true) { + // set true for everything + 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 + + } + } + + return rights; + } + +} |
