From 1e1b85270f93b3bca624c99b478f3a9a23be2395 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Sat, 29 Sep 2012 23:40:46 -0400 Subject: [PATCH] Preliminary implementation of server-side forking (issue 137) --- src/com/gitblit/FileUserService.java | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/com/gitblit/FileUserService.java b/src/com/gitblit/FileUserService.java index fcb8eae..40bc3f6 100644 --- a/src/com/gitblit/FileUserService.java +++ b/src/com/gitblit/FileUserService.java @@ -133,13 +133,16 @@ * @return cookie value */ @Override - public char[] getCookie(UserModel model) { + public String getCookie(UserModel model) { + if (!StringUtils.isEmpty(model.cookie)) { + return model.cookie; + } Properties allUsers = super.read(); String value = allUsers.getProperty(model.username); String[] roles = value.split(","); String password = roles[0]; String cookie = StringUtils.getSHA1(model.username + password); - return cookie.toCharArray(); + return cookie; } /** @@ -231,6 +234,8 @@ // Permissions if (role.equalsIgnoreCase(Constants.ADMIN_ROLE)) { model.canAdmin = true; + } else if (role.equalsIgnoreCase(Constants.FORK_ROLE)) { + model.canFork = true; } else if (role.equalsIgnoreCase(Constants.NOT_FEDERATED_ROLE)) { model.excludeFromFederation = true; } @@ -280,6 +285,9 @@ if (model.canAdmin) { roles.add(Constants.ADMIN_ROLE); } + if (model.canFork) { + roles.add(Constants.FORK_ROLE); + } if (model.excludeFromFederation) { roles.add(Constants.NOT_FEDERATED_ROLE); } -- Gitblit v1.9.1