projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change FCP access rules to a tri-state.
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
core
/
Core.java
diff --git
a/src/main/java/net/pterodactylus/sone/core/Core.java
b/src/main/java/net/pterodactylus/sone/core/Core.java
index
1860473
..
cfe53ea
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/core/Core.java
+++ b/
src/main/java/net/pterodactylus/sone/core/Core.java
@@
-38,6
+38,7
@@
import net.pterodactylus.sone.data.Profile.Field;
import net.pterodactylus.sone.data.Reply;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.fcp.FcpInterface;
import net.pterodactylus.sone.data.Reply;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.fcp.FcpInterface;
+import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired;
import net.pterodactylus.sone.freenet.wot.Identity;
import net.pterodactylus.sone.freenet.wot.IdentityListener;
import net.pterodactylus.sone.freenet.wot.IdentityManager;
import net.pterodactylus.sone.freenet.wot.Identity;
import net.pterodactylus.sone.freenet.wot.IdentityListener;
import net.pterodactylus.sone.freenet.wot.IdentityManager;
@@
-1707,7
+1708,7
@@
public class Core implements IdentityListener, UpdateListener {
configuration.getIntValue("Option/NegativeTrust").setValue(options.getIntegerOption("NegativeTrust").getReal());
configuration.getStringValue("Option/TrustComment").setValue(options.getStringOption("TrustComment").getReal());
configuration.getBooleanValue("Option/ActivateFcpInterface").setValue(options.getBooleanOption("ActivateFcpInterface").getReal());
configuration.getIntValue("Option/NegativeTrust").setValue(options.getIntegerOption("NegativeTrust").getReal());
configuration.getStringValue("Option/TrustComment").setValue(options.getStringOption("TrustComment").getReal());
configuration.getBooleanValue("Option/ActivateFcpInterface").setValue(options.getBooleanOption("ActivateFcpInterface").getReal());
- configuration.get
BooleanValue("Option/FcpWriteFromFullAccessOnly").setValue(options.getBooleanOption("FcpWriteFromFullAccessOnly
").getReal());
+ configuration.get
IntValue("Option/FcpFullAccessRequired").setValue(options.getIntegerOption("FcpFullAccessRequired
").getReal());
configuration.getBooleanValue("Option/SoneRescueMode").setValue(options.getBooleanOption("SoneRescueMode").getReal());
configuration.getBooleanValue("Option/ClearOnNextRestart").setValue(options.getBooleanOption("ClearOnNextRestart").getReal());
configuration.getBooleanValue("Option/ReallyClearOnNextRestart").setValue(options.getBooleanOption("ReallyClearOnNextRestart").getReal());
configuration.getBooleanValue("Option/SoneRescueMode").setValue(options.getBooleanOption("SoneRescueMode").getReal());
configuration.getBooleanValue("Option/ClearOnNextRestart").setValue(options.getBooleanOption("ClearOnNextRestart").getReal());
configuration.getBooleanValue("Option/ReallyClearOnNextRestart").setValue(options.getBooleanOption("ReallyClearOnNextRestart").getReal());
@@
-1790,12
+1791,12
@@
public class Core implements IdentityListener, UpdateListener {
fcpInterface.setActive(newValue);
}
}));
fcpInterface.setActive(newValue);
}
}));
- options.add
BooleanOption("FcpWriteFromFullAccessOnly", new DefaultOption<Boolean>(true, new OptionWatcher<Boolean
>() {
+ options.add
IntegerOption("FcpFullAccessRequired", new DefaultOption<Integer>(2, new OptionWatcher<Integer
>() {
@Override
@SuppressWarnings("synthetic-access")
@Override
@SuppressWarnings("synthetic-access")
- public void optionChanged(Option<
Boolean> option, Boolean oldValue, Boolean
newValue) {
- fcpInterface.set
AllowWriteFromFullAccessOnly(newValue
);
+ public void optionChanged(Option<
Integer> option, Integer oldValue, Integer
newValue) {
+ fcpInterface.set
FullAccessRequired(FullAccessRequired.values()[newValue]
);
}
}));
}
}));
@@
-1820,7
+1821,7
@@
public class Core implements IdentityListener, UpdateListener {
options.getIntegerOption("NegativeTrust").set(configuration.getIntValue("Option/NegativeTrust").getValue(null));
options.getStringOption("TrustComment").set(configuration.getStringValue("Option/TrustComment").getValue(null));
options.getBooleanOption("ActivateFcpInterface").set(configuration.getBooleanValue("Option/ActivateFcpInterface").getValue(null));
options.getIntegerOption("NegativeTrust").set(configuration.getIntValue("Option/NegativeTrust").getValue(null));
options.getStringOption("TrustComment").set(configuration.getStringValue("Option/TrustComment").getValue(null));
options.getBooleanOption("ActivateFcpInterface").set(configuration.getBooleanValue("Option/ActivateFcpInterface").getValue(null));
- options.get
BooleanOption("FcpWriteFromFullAccessOnly").set(configuration.getBooleanValue("Option/FcpWriteFromFullAccessOnly
").getValue(null));
+ options.get
IntegerOption("FcpFullAccessRequired").set(configuration.getIntValue("Option/FcpFullAccessRequired
").getValue(null));
options.getBooleanOption("SoneRescueMode").set(configuration.getBooleanValue("Option/SoneRescueMode").getValue(null));
/* load known Sones. */
options.getBooleanOption("SoneRescueMode").set(configuration.getBooleanValue("Option/SoneRescueMode").getValue(null));
/* load known Sones. */
@@
-2122,29
+2123,26
@@
public class Core implements IdentityListener, UpdateListener {
}
/**
}
/**
- * Returns
whether write access to the FCP interface is only allowed
- *
from the allowed FCP hosts of the node configuration
.
+ * Returns
the action level for which full access to the FCP interface
+ *
is required
.
*
*
- * @return {@code true} if only allowed hosts are allowed to change data
- * using the FCP interface, {@code false} if everybody can
- * change data using the FCP interface
+ * @return The action level for which full access to the FCP interface
+ * is required
*/
*/
- public
boolean isFcpWriteFromFullAccessOnly
() {
- return
options.getBooleanOption("FcpWriteFromFullAccessOnly").get()
;
+ public
FullAccessRequired getFcpFullAccessRequired
() {
+ return
FullAccessRequired.values()[options.getIntegerOption("FcpFullAccessRequired").get()]
;
}
/**
}
/**
- * Sets
whether write access to the FCP interface is only allowed from
- *
the allowed FCP hosts of the node configuration.
+ * Sets
the action level for which full access to the FCP interface is
+ *
required
*
*
- * @param fcpWriteFromFullAccessOnly
- * {@code true} if only allowed hosts should be allowed to
- * change data using the FCP interface, {@code false} if
- * everybody can change data using the FCP interface
- * @return This preferences object
+ * @param fcpFullAccessRequired
+ * The action level
+ * @return This preferences
*/
*/
- public Preferences setFcp
WriteFromFullAccessOnly(boolean fcpWriteFromFullAccessOnly
) {
- options.get
BooleanOption("FcpWriteFromFullAccessOnly").set(fcpWriteFromFullAccessOnly
);
+ public Preferences setFcp
FullAccessRequired(FullAccessRequired fcpFullAccessRequired
) {
+ options.get
IntegerOption("FcpFullAccessRequired").set((fcpFullAccessRequired != null) ? fcpFullAccessRequired.ordinal() : null
);
return this;
}
return this;
}