| | |
| | | import com.gitblit.models.SyndicatedEntryModel;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.utils.RpcUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.utils.SyndicationUtils;
|
| | |
|
| | | /**
|
| | |
| | | }
|
| | |
|
| | | public void login() throws IOException {
|
| | | refreshSettings();
|
| | | refreshAvailableFeeds();
|
| | | refreshRepositories();
|
| | |
|
| | |
| | | // credentials may not have administrator access
|
| | | // or server may have disabled rpc management
|
| | | refreshUsers();
|
| | | refreshSettings();
|
| | | allowManagement = true;
|
| | | } catch (UnauthorizedException e) {
|
| | | } catch (ForbiddenException e) {
|
| | |
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public boolean allowManagement() {
|
| | |
| | | return account != null && account.equalsIgnoreCase(model.owner);
|
| | | }
|
| | |
|
| | | public String getURL(String action, String repository, String objectId) {
|
| | | boolean mounted = settings.get(Keys.web.mountParameters).getBoolean(true);
|
| | | StringBuilder sb = new StringBuilder();
|
| | | sb.append(url);
|
| | | sb.append('/');
|
| | | sb.append(action);
|
| | | sb.append('/');
|
| | | if (mounted) {
|
| | | // mounted url/action/repository/objectId
|
| | | sb.append(StringUtils.encodeURL(repository));
|
| | | if (!StringUtils.isEmpty(objectId)) {
|
| | | sb.append('/');
|
| | | sb.append(objectId);
|
| | | }
|
| | | return sb.toString();
|
| | | } else {
|
| | | // parameterized url/action/&r=repository&h=objectId
|
| | | sb.append("?r=");
|
| | | sb.append(repository);
|
| | | if (!StringUtils.isEmpty(objectId)) {
|
| | | sb.append("&h=");
|
| | | sb.append(objectId);
|
| | | }
|
| | | return sb.toString();
|
| | | }
|
| | | }
|
| | |
|
| | | public ServerSettings getSettings() {
|
| | | return settings;
|
| | | }
|