| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package org.xwiki.security.authorization.testwikis.internal.entities; |
| 22 |
|
|
| 23 |
|
import org.xwiki.model.EntityType; |
| 24 |
|
import org.xwiki.model.reference.DocumentReference; |
| 25 |
|
import org.xwiki.model.reference.EntityReference; |
| 26 |
|
import org.xwiki.security.authorization.Right; |
| 27 |
|
import org.xwiki.security.authorization.RuleState; |
| 28 |
|
import org.xwiki.security.authorization.testwikis.SecureTestEntity; |
| 29 |
|
import org.xwiki.security.authorization.testwikis.TestAccessRule; |
| 30 |
|
import org.xwiki.security.authorization.testwikis.TestEntity; |
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
@version |
| 36 |
|
@since |
| 37 |
|
|
| |
|
| 90% |
Uncovered Elements: 2 (20) |
Complexity: 8 |
Complexity Density: 0.73 |
|
| 38 |
|
public class DefaultTestAccessRule extends AbstractTestEntity implements TestAccessRule |
| 39 |
|
{ |
| 40 |
|
|
| 41 |
|
public static final EntityType TYPE = EntityType.OBJECT; |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
private final DocumentReference userReference; |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
private final Right right; |
| 48 |
|
|
| 49 |
|
|
| 50 |
|
private final RuleState state; |
| 51 |
|
|
| 52 |
|
|
| 53 |
|
private final boolean isUser; |
| 54 |
|
|
| 55 |
|
|
| 56 |
|
|
| 57 |
|
@param |
| 58 |
|
@param |
| 59 |
|
@param |
| 60 |
|
@param |
| 61 |
|
@param |
| 62 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 63 |
869 |
public DefaultTestAccessRule(String user, EntityReference userReference, Right right, boolean state,... |
| 64 |
|
boolean isUser, TestEntity parent) { |
| 65 |
869 |
super( |
| 66 |
|
new EntityReference(String.format("%s@@%s@@%b", user, right.getName(), state), |
| 67 |
|
TYPE, parent.getReference()), |
| 68 |
|
parent); |
| 69 |
|
|
| 70 |
869 |
this.userReference = new DocumentReference(userReference); |
| 71 |
869 |
this.right = right; |
| 72 |
869 |
this.state = state ? RuleState.ALLOW : RuleState.DENY; |
| 73 |
869 |
this.isUser = isUser; |
| 74 |
|
} |
| 75 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 76 |
869 |
@Override... |
| 77 |
|
protected void addToParent(TestEntity parent) { |
| 78 |
869 |
((SecureTestEntity) parent).addSecurityRules(this); |
| 79 |
|
} |
| 80 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 81 |
0 |
@Override... |
| 82 |
|
public EntityType getType() |
| 83 |
|
{ |
| 84 |
0 |
return TYPE; |
| 85 |
|
} |
| 86 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 87 |
894 |
@Override... |
| 88 |
|
public DocumentReference getUser() |
| 89 |
|
{ |
| 90 |
894 |
return userReference; |
| 91 |
|
} |
| 92 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 93 |
894 |
@Override... |
| 94 |
|
public Right getRight() |
| 95 |
|
{ |
| 96 |
894 |
return right; |
| 97 |
|
} |
| 98 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 99 |
894 |
@Override... |
| 100 |
|
public RuleState getState() |
| 101 |
|
{ |
| 102 |
894 |
return state; |
| 103 |
|
} |
| 104 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 105 |
853 |
@Override... |
| 106 |
|
public boolean isUser() |
| 107 |
|
{ |
| 108 |
853 |
return isUser; |
| 109 |
|
} |
| 110 |
|
} |