package util; public class CheckIntegrity { // private static boolean isFine = false; // integrity check on permissions put by user for an image public static boolean[] isIntegreForImage(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); 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; } 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; }// end isIntegreForImage() // integrity check on permissions put by user for a lecture public static boolean[] isIntegreForLecture(boolean isRead, boolean isWrite, boolean isAdmin) { // boolean array for the correct result values boolean[] rights = new boolean[4]; rights[0] = isRead; rights[1] = isWrite; rights[2] = isAdmin; System.out.println("*****************************"); System.out.println(isRead + " " + isWrite + " " + isAdmin); 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; } if (isWrite) // if write was selected { rights[0] = true; rights[1] = true; } else // if write was unselected { // rights[0] = false; rights[1] = false; } if (isAdmin) // if admin is selected, anything is allowed { rights[0] = true; rights[1] = true; rights[2] = true; } else // if admin is unselected, admin is not allowed { rights[2] = false; } System.out.println(">-------------<"); System.out.println(rights[0] + " " + rights[1] + " " + rights[2]); return rights; }// end isIntegreForLecture() }