* @return a user object or null\r
*/\r
@Override\r
- public UserModel authenticate(char[] cookie) {\r
+ public synchronized UserModel authenticate(char[] cookie) {\r
String hash = new String(cookie);\r
if (StringUtils.isEmpty(hash)) {\r
return null;\r
* @return a user object or null\r
*/\r
@Override\r
- public UserModel getUserModel(String username) {\r
+ public synchronized UserModel getUserModel(String username) {\r
read();\r
UserModel model = users.get(username.toLowerCase());\r
if (model != null) {\r
* @since 1.2.0\r
*/\r
@Override\r
- public boolean updateUserModels(Collection<UserModel> models) {\r
+ public synchronized boolean updateUserModels(Collection<UserModel> models) {\r
try {\r
read();\r
for (UserModel model : models) {\r
* @return true if update is successful\r
*/\r
@Override\r
- public boolean updateUserModel(String username, UserModel model) {\r
+ public synchronized boolean updateUserModel(String username, UserModel model) {\r
UserModel originalUser = null;\r
try {\r
read();\r
* @return true if successful\r
*/\r
@Override\r
- public boolean deleteUser(String username) {\r
+ public synchronized boolean deleteUser(String username) {\r
try {\r
// Read realm file\r
read();\r
* @since 0.8.0\r
*/\r
@Override\r
- public List<TeamModel> getAllTeams() {\r
+ public synchronized List<TeamModel> getAllTeams() {\r
read();\r
List<TeamModel> list = new ArrayList<TeamModel>(teams.values());\r
list = DeepCopier.copy(list);\r
* @return list of all usernames that can bypass the access restriction\r
*/\r
@Override\r
- public List<String> getTeamnamesForRepositoryRole(String role) {\r
+ public synchronized List<String> getTeamnamesForRepositoryRole(String role) {\r
List<String> list = new ArrayList<String>();\r
try {\r
read();\r
* @return true if successful\r
*/\r
@Override\r
- public boolean setTeamnamesForRepositoryRole(String role, List<String> teamnames) {\r
+ public synchronized boolean setTeamnamesForRepositoryRole(String role, List<String> teamnames) {\r
try {\r
Set<String> specifiedTeams = new HashSet<String>();\r
for (String teamname : teamnames) {\r
* @since 0.8.0\r
*/\r
@Override\r
- public TeamModel getTeamModel(String teamname) {\r
+ public synchronized TeamModel getTeamModel(String teamname) {\r
read();\r
TeamModel model = teams.get(teamname.toLowerCase());\r
if (model != null) {\r
* @return list of all usernames\r
*/\r
@Override\r
- public List<UserModel> getAllUsers() {\r
+ public synchronized List<UserModel> getAllUsers() {\r
read();\r
List<UserModel> list = new ArrayList<UserModel>(users.values());\r
list = DeepCopier.copy(list);\r
* @return list of all usernames that can bypass the access restriction\r
*/\r
@Override\r
- public List<String> getUsernamesForRepositoryRole(String role) {\r
+ public synchronized List<String> getUsernamesForRepositoryRole(String role) {\r
List<String> list = new ArrayList<String>();\r
try {\r
read();\r
*/\r
@Override\r
@Deprecated\r
- public boolean setUsernamesForRepositoryRole(String role, List<String> usernames) {\r
+ public synchronized boolean setUsernamesForRepositoryRole(String role, List<String> usernames) {\r
try {\r
Set<String> specifiedUsers = new HashSet<String>();\r
for (String username : usernames) {\r
* @return true if successful\r
*/\r
@Override\r
- public boolean renameRepositoryRole(String oldRole, String newRole) {\r
+ public synchronized boolean renameRepositoryRole(String oldRole, String newRole) {\r
try {\r
read();\r
// identify users which require role rename\r
* @return true if successful\r
*/\r
@Override\r
- public boolean deleteRepositoryRole(String role) {\r
+ public synchronized boolean deleteRepositoryRole(String role) {\r
try {\r
read();\r
\r