blob: d87a857990db6a39c159c66c452aeec372b1b512 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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;
}
}
|