CryptoParam
+ *
+ * @return array The configuration array.
+ */
+ public function configuration();
}
diff --git a/lib/Crypto/Phpass.php b/lib/Crypto/Phpass.php
index bea911d..7edd728 100644
--- a/lib/Crypto/Phpass.php
+++ b/lib/Crypto/Phpass.php
@@ -155,6 +155,14 @@ class Phpass extends AbstractAlgorithm
return $output;
}
+ /**
+ * @inheritdoc
+ */
+ public function configuration()
+ {
+ return [new CryptoParam("Iterations (log2)", 8, 4, 31)];
+ }
+
/**
* @inheritdoc
*/
diff --git a/lib/Properties.php b/lib/Properties.php
index b030b82..36413f5 100644
--- a/lib/Properties.php
+++ b/lib/Properties.php
@@ -99,10 +99,12 @@ class Properties implements \ArrayAccess
foreach ($params as $param) {
$value = $this->config->getAppValue($this->appName, $param, null);
- if ($value === App::FALSE_VALUE) {
- $value = false;
- } elseif ($value === App::TRUE_VALUE) {
- $value = true;
+ if ($this->isBooleanParam($param)) {
+ if ($value === App::FALSE_VALUE) {
+ $value = false;
+ } elseif ($value === App::TRUE_VALUE) {
+ $value = true;
+ }
}
$this->data[$param] = $value;
@@ -141,6 +143,24 @@ class Properties implements \ArrayAccess
return $params;
}
+ /**
+ * Is given parameter a boolean parameter.
+ *
+ * @param $param string Parameter name.
+ *
+ * @return bool Is a boolean parameter.
+ */
+ private function isBooleanParam($param)
+ {
+ return in_array(
+ $param, [
+ Opt::APPEND_SALT, Opt::CASE_INSENSITIVE_USERNAME,
+ Opt::NAME_CHANGE, Opt::PASSWORD_CHANGE, Opt::PREPEND_SALT,
+ Opt::PROVIDE_AVATAR, Opt::REVERSE_ACTIVE, Opt::USE_CACHE
+ ]
+ );
+ }
+
/**
* Store properties in the cache memory.
*/
@@ -186,10 +206,12 @@ class Properties implements \ArrayAccess
{
$this->config->setAppValue($this->appName, $offset, $value);
- if ($value === App::FALSE_VALUE) {
- $value = false;
- } elseif ($value === App::TRUE_VALUE) {
- $value = true;
+ if ($this->isBooleanParam($offset)) {
+ if ($value === App::FALSE_VALUE) {
+ $value = false;
+ } elseif ($value === App::TRUE_VALUE) {
+ $value = true;
+ }
}
$this->data[$offset] = $value;
@@ -206,6 +228,7 @@ class Properties implements \ArrayAccess
*/
public function offsetUnset($offset)
{
+ $this->config->deleteAppValue($this->appName, $offset);
unset($this->data[$offset]);
}
}
diff --git a/lib/Query/QueryProvider.php b/lib/Query/QueryProvider.php
index 0a1bf76..15092cb 100644
--- a/lib/Query/QueryProvider.php
+++ b/lib/Query/QueryProvider.php
@@ -22,6 +22,7 @@
namespace OCA\UserSQL\Query;
use OCA\UserSQL\Constant\DB;
+use OCA\UserSQL\Constant\Opt;
use OCA\UserSQL\Constant\Query;
use OCA\UserSQL\Properties;
@@ -86,6 +87,8 @@ class QueryProvider implements \ArrayAccess
$searchParam = Query::SEARCH_PARAM;
$uidParam = Query::UID_PARAM;
+ $reverseActiveOpt = $this->properties[Opt::REVERSE_ACTIVE];
+
$groupColumns
= "g.$gGID AS gid, " .
(empty($gName) ? "g." . $gGID : "g." . $gName) . " AS name, " .
@@ -96,7 +99,7 @@ class QueryProvider implements \ArrayAccess
(empty($uEmail) ? "null" : "u." . $uEmail) . " AS email, " .
(empty($uQuota) ? "null" : "u." . $uQuota) . " AS quota, " .
(empty($uHome) ? "null" : "u." . $uHome) . " AS home, " .
- (empty($uActive) ? "true" : "u." . $uActive) . " AS active, " .
+ (empty($uActive) ? "true" : (empty($reverseActiveOpt) ? "" : "NOT ") . "u." . $uActive) . " AS active, " .
(empty($uAvatar) ? "false" : "u." . $uAvatar) . " AS avatar, " .
(empty($uSalt) ? "null" : "u." . $uSalt) . " AS salt";
diff --git a/templates/admin.php b/templates/admin.php
index c00b06e..579fb94 100644
--- a/templates/admin.php
+++ b/templates/admin.php
@@ -110,7 +110,9 @@ function print_select_options(