001
014
015 package com.liferay.portal.kernel.webdav;
016
017 import com.liferay.portal.kernel.exception.SystemException;
018 import com.liferay.portal.model.Group;
019 import com.liferay.portal.model.Lock;
020 import com.liferay.portal.service.GroupLocalServiceUtil;
021 import com.liferay.portal.service.LayoutLocalServiceUtil;
022
023 import javax.servlet.http.HttpServletResponse;
024
025
028 public abstract class BaseWebDAVStorageImpl implements WebDAVStorage {
029
030 @Override
031 @SuppressWarnings("unused")
032 public int copyCollectionResource(
033 WebDAVRequest webDavRequest, Resource resource, String destination,
034 boolean overwrite, long depth)
035 throws WebDAVException {
036
037 return HttpServletResponse.SC_FORBIDDEN;
038 }
039
040 @Override
041 @SuppressWarnings("unused")
042 public int copySimpleResource(
043 WebDAVRequest webDavRequest, Resource resource, String destination,
044 boolean overwrite)
045 throws WebDAVException {
046
047 return HttpServletResponse.SC_FORBIDDEN;
048 }
049
050 @Override
051 @SuppressWarnings("unused")
052 public int deleteResource(WebDAVRequest webDavRequest)
053 throws WebDAVException {
054
055 return HttpServletResponse.SC_FORBIDDEN;
056 }
057
058 @Override
059 public String getRootPath() {
060 return _rootPath;
061 }
062
063 @Override
064 public String getToken() {
065 return _token;
066 }
067
068 @Override
069 public boolean isAvailable(WebDAVRequest webDavRequest)
070 throws WebDAVException {
071
072 if (getResource(webDavRequest) == null) {
073 return false;
074 }
075 else {
076 return true;
077 }
078 }
079
080 @Override
081 public boolean isSupportsClassTwo() {
082 return false;
083 }
084
085 @Override
086 @SuppressWarnings("unused")
087 public Status lockResource(
088 WebDAVRequest webDavRequest, String owner, long timeout)
089 throws WebDAVException {
090
091 return null;
092 }
093
094 @Override
095 @SuppressWarnings("unused")
096 public Status makeCollection(WebDAVRequest webDavRequest)
097 throws WebDAVException {
098
099 return new Status(HttpServletResponse.SC_FORBIDDEN);
100 }
101
102 @Override
103 @SuppressWarnings("unused")
104 public int moveCollectionResource(
105 WebDAVRequest webDavRequest, Resource resource, String destination,
106 boolean overwrite)
107 throws WebDAVException {
108
109 return HttpServletResponse.SC_FORBIDDEN;
110 }
111
112 @Override
113 @SuppressWarnings("unused")
114 public int moveSimpleResource(
115 WebDAVRequest webDavRequest, Resource resource, String destination,
116 boolean overwrite)
117 throws WebDAVException {
118
119 return HttpServletResponse.SC_FORBIDDEN;
120 }
121
122 @Override
123 @SuppressWarnings("unused")
124 public int putResource(WebDAVRequest webDavRequest) throws WebDAVException {
125 return HttpServletResponse.SC_FORBIDDEN;
126 }
127
128 @Override
129 @SuppressWarnings("unused")
130 public Lock refreshResourceLock(
131 WebDAVRequest webDavRequest, String uuid, long timeout)
132 throws WebDAVException {
133
134 return null;
135 }
136
137 @Override
138 public void setRootPath(String rootPath) {
139 _rootPath = rootPath;
140 }
141
142 @Override
143 public void setToken(String token) {
144 _token = token;
145 }
146
147 @Override
148 @SuppressWarnings("unused")
149 public boolean unlockResource(WebDAVRequest webDavRequest, String token)
150 throws WebDAVException {
151
152 return false;
153 }
154
155 protected long getPlid(long groupId) throws SystemException {
156 return LayoutLocalServiceUtil.getDefaultPlid(groupId);
157 }
158
159 protected boolean isAddGroupPermissions(long groupId) throws Exception {
160 Group group = GroupLocalServiceUtil.getGroup(groupId);
161
162 if (!group.isUser()) {
163 return true;
164 }
165 else {
166 return false;
167 }
168 }
169
170 private String _rootPath;
171 private String _token;
172
173 }