| | |
| | | import com.gitblit.Constants.AccessPermission;
|
| | | import com.gitblit.models.TeamModel;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.models.UserRepositoryPreferences;
|
| | | import com.gitblit.utils.ArrayUtils;
|
| | | import com.gitblit.utils.DeepCopier;
|
| | | import com.gitblit.utils.StringUtils;
|
| | |
| | | private static final String PRERECEIVE = "preReceiveScript";
|
| | |
|
| | | private static final String POSTRECEIVE = "postReceiveScript";
|
| | | |
| | | private static final String STARRED = "starred";
|
| | | |
| | | private static final String LOCALE = "locale";
|
| | |
|
| | | private final File realmFile;
|
| | |
|
| | |
| | | if (!StringUtils.isEmpty(model.countryCode)) {
|
| | | config.setString(USER, model.username, COUNTRYCODE, model.countryCode);
|
| | | }
|
| | | if (model.getPreferences() != null) {
|
| | | if (!StringUtils.isEmpty(model.getPreferences().locale)) {
|
| | | config.setString(USER, model.username, LOCALE, model.getPreferences().locale);
|
| | | }
|
| | | }
|
| | |
|
| | | // user roles
|
| | | List<String> roles = new ArrayList<String>();
|
| | |
| | | }
|
| | | }
|
| | | config.setStringList(USER, model.username, REPOSITORY, permissions);
|
| | | }
|
| | | |
| | | // user preferences
|
| | | if (model.getPreferences() != null) {
|
| | | List<String> starred = model.getPreferences().getStarredRepositories();
|
| | | if (starred.size() > 0) {
|
| | | config.setStringList(USER, model.username, STARRED, starred);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | user.stateProvince = config.getString(USER, username, STATEPROVINCE);
|
| | | user.countryCode = config.getString(USER, username, COUNTRYCODE);
|
| | | user.cookie = config.getString(USER, username, COOKIE);
|
| | | user.getPreferences().locale = config.getString(USER, username, LOCALE); |
| | | if (StringUtils.isEmpty(user.cookie) && !StringUtils.isEmpty(user.password)) {
|
| | | user.cookie = StringUtils.getSHA1(user.username + user.password);
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | // starred repositories
|
| | | Set<String> starred = new HashSet<String>(Arrays.asList(config
|
| | | .getStringList(USER, username, STARRED)));
|
| | | for (String repository : starred) {
|
| | | UserRepositoryPreferences prefs = user.getPreferences().getRepositoryPreferences(repository);
|
| | | prefs.starred = true;
|
| | | }
|
| | |
|
| | | // update cache
|
| | | users.put(user.username, user);
|
| | | if (!StringUtils.isEmpty(user.cookie)) {
|