| | |
| | | // grab primary url from the top of the list
|
| | | primaryUrl = repositoryUrls.size() == 0 ? null : repositoryUrls.get(0);
|
| | |
|
| | | boolean canClone = ((primaryUrl.permission == null) || primaryUrl.permission.atLeast(AccessPermission.CLONE));
|
| | | boolean canClone = primaryUrl != null && ((primaryUrl.permission == null) || primaryUrl.permission.atLeast(AccessPermission.CLONE));
|
| | |
|
| | | if (repositoryUrls.size() == 0 || !canClone) {
|
| | | // no urls, nothing to show.
|
| | |
| | | }
|
| | |
|
| | | // access restriction icon and tooltip
|
| | | if (isGitblitServingRepositories()) {
|
| | | if (GitBlit.isServingRepositories()) {
|
| | | switch (repository.accessRestriction) {
|
| | | case NONE:
|
| | | urlPanel.add(WicketUtils.newClearPixel("accessRestrictionIcon").setVisible(false));
|
| | |
| | | final GitClientApplication clientApp = item.getModelObject();
|
| | |
|
| | | // filter the urls for the client app
|
| | | List<RepositoryUrl> urls;
|
| | | if (clientApp.minimumPermission == null) {
|
| | | // client app does not specify minimum access permission
|
| | | urls = repositoryUrls;
|
| | | } else {
|
| | | urls = new ArrayList<RepositoryUrl>();
|
| | | for (RepositoryUrl repoUrl : repositoryUrls) {
|
| | | if (repoUrl.permission == null) {
|
| | | // external permissions, assume it is satisfactory
|
| | | List<RepositoryUrl> urls = new ArrayList<RepositoryUrl>();
|
| | | for (RepositoryUrl repoUrl : repositoryUrls) {
|
| | | if (clientApp.minimumPermission == null || repoUrl.permission == null) {
|
| | | // no minimum permission or external permissions, assume it is satisfactory
|
| | | if (clientApp.supportsTransport(repoUrl.url)) {
|
| | | urls.add(repoUrl);
|
| | | } else if (repoUrl.permission.atLeast(clientApp.minimumPermission)) {
|
| | | // repo url meets minimum permission requirement
|
| | | }
|
| | | } else if (repoUrl.permission.atLeast(clientApp.minimumPermission)) {
|
| | | // repo url meets minimum permission requirement
|
| | | if (clientApp.supportsTransport(repoUrl.url)) {
|
| | | urls.add(repoUrl);
|
| | | }
|
| | | }
|
| | |
| | | return pattern.replace("${repoUrl}", repoUrl).replace("${baseUrl}", baseUrl);
|
| | | }
|
| | |
|
| | | protected boolean isGitblitServingRepositories() {
|
| | | return GitBlit.getBoolean(Keys.git.enableGitServlet, true) || (GitBlit.getInteger(Keys.git.daemonPort, 0) > 0);
|
| | | }
|
| | | |
| | | protected Label createPermissionBadge(String wicketId, RepositoryUrl repoUrl) {
|
| | | Label permissionLabel = new Label(wicketId, repoUrl.isExternal() ? externalPermission : repoUrl.permission.toString());
|
| | | WicketUtils.setPermissionClass(permissionLabel, repoUrl.permission);
|
| | |
| | | if (!urlPermissionsMap.containsKey(repoUrl.url)) {
|
| | | String note;
|
| | | if (repoUrl.isExternal()) {
|
| | | String protocol = repoUrl.url.substring(0, repoUrl.url.indexOf("://"));
|
| | | String protocol;
|
| | | int protocolIndex = repoUrl.url.indexOf("://");
|
| | | if (protocolIndex > -1) {
|
| | | // explicit protocol specified
|
| | | protocol = repoUrl.url.substring(0, protocolIndex);
|
| | | } else {
|
| | | // implicit SSH url
|
| | | protocol = "ssh";
|
| | | }
|
| | | note = MessageFormat.format(getString("gb.externalPermissions"), protocol);
|
| | | } else {
|
| | | note = null;
|