-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #944 from ZakarFin/users
Improve user management services to enable UI changes
- Loading branch information
Showing
7 changed files
with
307 additions
and
338 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
control-admin/src/main/java/fi/nls/oskari/control/admin/UsersBundleHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package fi.nls.oskari.control.admin; | ||
|
||
import fi.nls.oskari.annotation.OskariViewModifier; | ||
import fi.nls.oskari.control.view.modifier.bundle.BundleHandler; | ||
import fi.nls.oskari.util.JSONHelper; | ||
import fi.nls.oskari.util.PropertyUtil; | ||
import fi.nls.oskari.view.modifier.ModifierException; | ||
import fi.nls.oskari.view.modifier.ModifierParams; | ||
import org.json.JSONObject; | ||
import org.oskari.user.util.UserHelper; | ||
|
||
|
||
/** | ||
* Injects password requirements to admin-users config | ||
{ | ||
"requirements": { | ||
"length": 8, | ||
"case": true | ||
}, | ||
"isExternal": false | ||
} | ||
*/ | ||
@OskariViewModifier("admin-users") | ||
public class UsersBundleHandler extends BundleHandler { | ||
|
||
public boolean modifyBundle(final ModifierParams params) throws ModifierException { | ||
final JSONObject config = getBundleConfig(params.getConfig()); | ||
JSONHelper.putValue(config, "requirements", UserHelper.getPasswordRequirements()); | ||
JSONHelper.putValue(config, "isExternal", isUsersFromExternalSource()); | ||
return false; | ||
} | ||
|
||
/** | ||
* If users are managed in external source any changes to them are usually overwritten when they login. | ||
* So we can disable the fields that are and updates that can happen to users to make the admin UI more user-friendly. | ||
* @return | ||
*/ | ||
public static boolean isUsersFromExternalSource() { | ||
return PropertyUtil.getOptional("oskari.user.external", false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.