diff options
author | James Moger <james.moger@gitblit.com> | 2011-09-12 15:37:55 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2011-09-12 15:37:55 -0400 |
commit | 831469ba89ea8bca3bfbd1d662dbdd2c9f233798 (patch) | |
tree | b36d770bcaf0c6a2ab8caf865f04ff60734ed71f /src/com/gitblit/FileUserService.java | |
parent | cbf59502795be12dc0015e05523076a9561df807 (diff) | |
download | gitblit-831469ba89ea8bca3bfbd1d662dbdd2c9f233798.tar.gz gitblit-831469ba89ea8bca3bfbd1d662dbdd2c9f233798.zip |
Largely completed, uber-cool federation feature.
Diffstat (limited to 'src/com/gitblit/FileUserService.java')
-rw-r--r-- | src/com/gitblit/FileUserService.java | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/com/gitblit/FileUserService.java b/src/com/gitblit/FileUserService.java index 12164ce6..9dc80087 100644 --- a/src/com/gitblit/FileUserService.java +++ b/src/com/gitblit/FileUserService.java @@ -149,6 +149,8 @@ public class FileUserService extends FileSettings implements IUserService { // Permissions
if (role.equalsIgnoreCase(Constants.ADMIN_ROLE)) {
model.canAdmin = true;
+ } else if (role.equalsIgnoreCase(Constants.NOT_FEDERATED_ROLE)) {
+ model.excludeFromFederation = true;
}
break;
default:
@@ -189,6 +191,9 @@ public class FileUserService extends FileSettings implements IUserService { if (model.canAdmin) {
roles.add(Constants.ADMIN_ROLE);
}
+ if (model.excludeFromFederation) {
+ roles.add(Constants.NOT_FEDERATED_ROLE);
+ }
StringBuilder sb = new StringBuilder();
sb.append(model.password);
@@ -499,14 +504,15 @@ public class FileUserService extends FileSettings implements IUserService { // If the write is successful, delete the current file and rename
// the temporary copy to the original filename.
if (realmFileCopy.exists() && realmFileCopy.length() > 0) {
- if (propertiesFile.delete()) {
- if (!realmFileCopy.renameTo(propertiesFile)) {
- throw new IOException(MessageFormat.format("Failed to rename {0} to {1}!",
- realmFileCopy.getAbsolutePath(), propertiesFile.getAbsolutePath()));
+ if (propertiesFile.exists()) {
+ if (!propertiesFile.delete()) {
+ throw new IOException(MessageFormat.format("Failed to delete {0}!",
+ propertiesFile.getAbsolutePath()));
}
- } else {
- throw new IOException(MessageFormat.format("Failed to delete (0)!",
- propertiesFile.getAbsolutePath()));
+ }
+ if (!realmFileCopy.renameTo(propertiesFile)) {
+ throw new IOException(MessageFormat.format("Failed to rename {0} to {1}!",
+ realmFileCopy.getAbsolutePath(), propertiesFile.getAbsolutePath()));
}
} else {
throw new IOException(MessageFormat.format("Failed to save {0}!",
|