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; } }