commit | author | age
|
828add
|
1 |
/*
|
JM |
2 |
* Copyright 2013 gitblit.com.
|
|
3 |
*
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
6 |
* You may obtain a copy of the License at
|
|
7 |
*
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9 |
*
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13 |
* See the License for the specific language governing permissions and
|
|
14 |
* limitations under the License.
|
|
15 |
*/
|
|
16 |
package com.gitblit.models;
|
|
17 |
|
|
18 |
import java.io.Serializable;
|
|
19 |
|
|
20 |
import com.gitblit.Constants.AccessPermission;
|
e9872c
|
21 |
import com.gitblit.Constants.Transport;
|
828add
|
22 |
|
JM |
23 |
/**
|
|
24 |
* Represents a git repository url and it's associated access permission for the
|
|
25 |
* current user.
|
699e71
|
26 |
*
|
828add
|
27 |
* @author James Moger
|
JM |
28 |
*
|
|
29 |
*/
|
|
30 |
public class RepositoryUrl implements Serializable {
|
|
31 |
|
|
32 |
private static final long serialVersionUID = 1L;
|
|
33 |
|
e9872c
|
34 |
public final Transport transport;
|
828add
|
35 |
public final String url;
|
JM |
36 |
public final AccessPermission permission;
|
|
37 |
|
|
38 |
public RepositoryUrl(String url, AccessPermission permission) {
|
e9872c
|
39 |
this.transport = Transport.fromUrl(url);
|
828add
|
40 |
this.url = url;
|
JM |
41 |
this.permission = permission;
|
|
42 |
}
|
699e71
|
43 |
|
1590fd
|
44 |
public boolean hasPermission() {
|
JJ |
45 |
return permission != null;
|
828add
|
46 |
}
|
JM |
47 |
|
|
48 |
@Override
|
|
49 |
public String toString() {
|
|
50 |
return url;
|
|
51 |
}
|
|
52 |
} |