Mercurial > hg > AnnotationManagerN4J
annotate src/main/java/de/mpiwg/itgroup/annotations/Annotation.java @ 103:f83eb8b335b1
fix problem with anonymous being different.
| author | casties |
|---|---|
| date | Thu, 09 Feb 2017 21:17:04 +0100 |
| parents | acd44dfec9c8 |
| children | 7417f5915181 |
| rev | line source |
|---|---|
| 4 | 1 /** |
| 2 * | |
| 3 */ | |
| 4 package de.mpiwg.itgroup.annotations; | |
| 5 | |
| 70 | 6 /* |
| 7 * #%L | |
| 8 * AnnotationManager | |
| 9 * %% | |
| 10 * Copyright (C) 2012 - 2014 MPIWG Berlin | |
| 11 * %% | |
| 12 * This program is free software: you can redistribute it and/or modify | |
| 13 * it under the terms of the GNU Lesser General Public License as | |
| 14 * published by the Free Software Foundation, either version 3 of the | |
| 15 * License, or (at your option) any later version. | |
| 16 * | |
| 17 * This program is distributed in the hope that it will be useful, | |
| 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 20 * GNU General Lesser Public License for more details. | |
| 21 * | |
| 22 * You should have received a copy of the GNU General Lesser Public | |
| 23 * License along with this program. If not, see | |
| 24 * <http://www.gnu.org/licenses/lgpl-3.0.html>. | |
| 25 * #L% | |
| 26 */ | |
| 27 | |
| 50 | 28 import java.io.UnsupportedEncodingException; |
| 16 | 29 import java.util.Set; |
| 30 | |
| 50 | 31 import org.apache.commons.codec.binary.Base64; |
| 32 | |
| 15 | 33 import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore; |
| 34 | |
| 4 | 35 /** |
| 36 * @author casties | |
| 37 * | |
| 38 */ | |
| 39 public class Annotation { | |
| 40 /** | |
| 41 * The URI of this annotation. | |
| 42 */ | |
| 43 protected String uri; | |
| 44 | |
| 45 /** | |
| 46 * The annotation (body) text. | |
| 47 */ | |
| 48 protected String bodyText; | |
| 49 | |
| 50 /** | |
| 51 * The URI of the annotation text | |
| 52 */ | |
| 53 protected String bodyUri; | |
| 54 | |
| 55 /** | |
|
48
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
56 * The annotation target. |
| 4 | 57 */ |
|
48
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
58 protected Target target; |
| 4 | 59 |
| 60 /** | |
| 61 * The fragment part of the annotation target. | |
| 62 */ | |
| 63 protected String targetFragment; | |
| 64 | |
| 65 /** | |
|
40
03e0f7574224
saving and loading resource targets should work now (no searching yet)
casties
parents:
20
diff
changeset
|
66 * The types of annotation target fragments. |
| 4 | 67 * |
| 68 */ | |
| 69 public static enum FragmentTypes { | |
| 84 | 70 XPOINTER, AREA, WKT |
| 4 | 71 }; |
| 72 | |
| 73 /** | |
| 74 * The type of the annotation target fragment. | |
| 75 */ | |
| 76 protected FragmentTypes fragmentType; | |
| 77 | |
| 76 | 78 /** |
| 79 * The selected text of the annotation target. | |
| 80 */ | |
| 81 protected String quote; | |
|
40
03e0f7574224
saving and loading resource targets should work now (no searching yet)
casties
parents:
20
diff
changeset
|
82 |
|
03e0f7574224
saving and loading resource targets should work now (no searching yet)
casties
parents:
20
diff
changeset
|
83 /** |
|
48
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
84 * The Resource that is annotated e.g. a book. |
|
40
03e0f7574224
saving and loading resource targets should work now (no searching yet)
casties
parents:
20
diff
changeset
|
85 * The target is part of this resource e.g. a page of a book. |
|
03e0f7574224
saving and loading resource targets should work now (no searching yet)
casties
parents:
20
diff
changeset
|
86 */ |
|
48
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
87 protected Resource resource; |
|
40
03e0f7574224
saving and loading resource targets should work now (no searching yet)
casties
parents:
20
diff
changeset
|
88 |
| 4 | 89 /** |
| 9 | 90 * The creator of this annotation. |
| 4 | 91 */ |
| 9 | 92 protected Actor creator; |
| 5 | 93 |
| 94 /** | |
| 4 | 95 * The creation date of this annotation. |
| 96 */ | |
| 97 protected String created; | |
| 98 | |
| 10 | 99 /** |
|
95
acd44dfec9c8
added last update field for annotations in database.
casties
parents:
84
diff
changeset
|
100 * The last update date of this annotation. |
|
acd44dfec9c8
added last update field for annotations in database.
casties
parents:
84
diff
changeset
|
101 */ |
|
acd44dfec9c8
added last update field for annotations in database.
casties
parents:
84
diff
changeset
|
102 protected String updated; |
|
acd44dfec9c8
added last update field for annotations in database.
casties
parents:
84
diff
changeset
|
103 |
|
acd44dfec9c8
added last update field for annotations in database.
casties
parents:
84
diff
changeset
|
104 /** |
| 10 | 105 * The user or group that has admin permissions. |
| 106 * null means any user. | |
| 107 */ | |
| 108 protected Actor adminPermission; | |
| 109 | |
| 110 /** | |
| 111 * The user or group that has delete permissions. | |
| 112 * null means any user. | |
| 113 */ | |
| 114 protected Actor deletePermission; | |
| 115 | |
| 116 /** | |
| 117 * The user or group that has update permissions. | |
| 118 * null means any user. | |
| 119 */ | |
| 120 protected Actor updatePermission; | |
| 121 | |
| 122 /** | |
| 123 * The user or group that has read permissions. | |
| 124 * null means any user. | |
| 125 */ | |
| 126 protected Actor readPermission; | |
| 16 | 127 |
| 128 /** | |
| 129 * List of tags on this Annotation. | |
| 130 */ | |
| 131 protected Set<String> tags; | |
|
14
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
132 |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
133 /** |
|
20
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
134 * Returns if the requested action is allowed for the given user on this annotation. |
|
14
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
135 * |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
136 * @param action |
| 15 | 137 * @param user |
| 138 * @param store AnnotationStore to check group membership | |
|
14
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
139 * @return |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
140 */ |
| 15 | 141 public boolean isActionAllowed(String action, Person user, AnnotationStore store) { |
|
14
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
142 if (action.equals("read")) { |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
143 Actor reader = getReadPermission(); |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
144 if (reader == null) { |
|
20
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
145 // if not specified then everybody is allowed |
|
14
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
146 return true; |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
147 } else { |
| 15 | 148 return reader.isEquivalentWith(user, store); |
|
14
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
149 } |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
150 } else if (action.equals("update")) { |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
151 // require at least an authenticated user |
| 15 | 152 if (user == null) return false; |
|
14
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
153 Actor updater = getUpdatePermission(); |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
154 if (updater == null) { |
|
20
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
155 // if not specified then everybody is allowed |
|
14
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
156 return true; |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
157 } else { |
| 15 | 158 return updater.isEquivalentWith(user, store); |
|
14
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
159 } |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
160 } else if (action.equals("delete")) { |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
161 // require at least an authenticated user |
| 15 | 162 if (user == null) return false; |
|
20
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
163 Actor deleter = getDeletePermission(); |
|
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
164 if (deleter == null) { |
|
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
165 // if not specified then only creator is allowed |
|
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
166 deleter = creator; |
|
14
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
167 } |
|
20
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
168 return deleter.isEquivalentWith(user, store); |
|
14
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
169 } else if (action.equals("admin")) { |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
170 // require at least an authenticated user |
| 15 | 171 if (user == null) return false; |
|
14
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
172 Actor admin = getAdminPermission(); |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
173 if (admin == null) { |
|
20
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
174 // if not specified then only creator is allowed |
|
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
175 admin = creator; |
|
14
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
176 } |
|
20
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
177 return admin.isEquivalentWith(user, store); |
|
14
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
178 } |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
179 return false; |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
180 } |
|
629e15b345aa
permissions mostly work. need more server-side checking.
casties
parents:
10
diff
changeset
|
181 |
| 4 | 182 /** |
| 183 * @return the uri | |
| 184 */ | |
| 185 public String getUri() { | |
| 186 return uri; | |
| 187 } | |
| 188 | |
| 189 /** | |
| 190 * @param uri the uri to set | |
| 191 */ | |
| 192 public void setUri(String uri) { | |
| 193 this.uri = uri; | |
| 194 } | |
| 195 | |
| 196 /** | |
| 50 | 197 * Returns an URL-compatible id. |
| 198 * Currently the uri as base64 encoded string. | |
| 199 * @return | |
| 200 */ | |
| 201 public String getUrlId() { | |
| 202 if (uri == null) return null; | |
| 203 try { | |
| 204 return Base64.encodeBase64URLSafeString(uri.getBytes("UTF-8")); | |
| 205 } catch (UnsupportedEncodingException e) { | |
| 206 return null; | |
| 207 } | |
| 208 } | |
| 209 | |
| 210 public static String decodeId(String id) { | |
| 211 if (id == null) return null; | |
| 212 try { | |
| 213 return new String(Base64.decodeBase64(id), "UTF-8"); | |
| 214 } catch (UnsupportedEncodingException e) { | |
| 215 return null; | |
| 216 } | |
| 217 } | |
| 218 | |
| 219 /** | |
| 4 | 220 * @return the bodyText |
| 221 */ | |
| 222 public String getBodyText() { | |
| 223 return bodyText; | |
| 224 } | |
| 225 | |
| 226 /** | |
| 227 * @param bodyText the bodyText to set | |
| 228 */ | |
| 229 public void setBodyText(String bodyText) { | |
| 230 this.bodyText = bodyText; | |
| 231 } | |
| 232 | |
| 233 /** | |
| 234 * @return the bodyUri | |
| 235 */ | |
| 236 public String getBodyUri() { | |
| 237 return bodyUri; | |
| 238 } | |
| 239 | |
| 240 /** | |
| 241 * @param bodyUri the bodyUri to set | |
| 242 */ | |
| 243 public void setBodyUri(String bodyUri) { | |
| 244 this.bodyUri = bodyUri; | |
| 245 } | |
| 246 | |
| 247 /** | |
|
48
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
248 * @return the target |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
249 */ |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
250 public Target getTarget() { |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
251 return target; |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
252 } |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
253 |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
254 /** |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
255 * @param target the target to set |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
256 */ |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
257 public void setTarget(Target target) { |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
258 this.target = target; |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
259 } |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
260 |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
261 /** |
| 4 | 262 * @return the targetBaseUri |
| 263 */ | |
| 264 public String getTargetBaseUri() { | |
|
48
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
265 if (target == null) return null; |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
266 return target.getUri(); |
| 4 | 267 } |
| 268 | |
| 269 /** | |
| 270 * @return the targetFragment | |
| 271 */ | |
| 272 public String getTargetFragment() { | |
| 273 return targetFragment; | |
| 274 } | |
| 275 | |
| 276 /** | |
| 277 * @param targetFragment the targetFragment to set | |
| 278 */ | |
| 279 public void setTargetFragment(String targetFragment) { | |
| 280 this.targetFragment = targetFragment; | |
| 281 } | |
| 282 | |
| 283 /** | |
| 284 * @return the targetType | |
| 285 */ | |
| 286 public FragmentTypes getFragmentType() { | |
| 287 return fragmentType; | |
| 288 } | |
| 289 | |
| 290 /** | |
| 291 * @param fragmentType the fragmentType to set | |
| 292 */ | |
| 293 public void setFragmentType(FragmentTypes fragmentType) { | |
| 294 this.fragmentType = fragmentType; | |
| 295 } | |
| 296 | |
| 297 /** | |
| 76 | 298 * @return the quote |
| 299 */ | |
| 300 public String getQuote() { | |
| 301 return quote; | |
| 302 } | |
| 303 | |
| 304 /** | |
| 305 * @param quote the quote to set | |
| 306 */ | |
| 307 public void setQuote(String quote) { | |
| 308 this.quote = quote; | |
| 309 } | |
| 310 | |
| 311 /** | |
|
48
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
312 * @return the resource |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
313 */ |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
314 public Resource getResource() { |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
315 return resource; |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
316 } |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
317 |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
318 /** |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
319 * @param resource the resource to set |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
320 */ |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
321 public void setResource(Resource resource) { |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
322 this.resource = resource; |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
323 } |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
324 |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
325 /** |
|
40
03e0f7574224
saving and loading resource targets should work now (no searching yet)
casties
parents:
20
diff
changeset
|
326 * @return the resourceUri |
|
03e0f7574224
saving and loading resource targets should work now (no searching yet)
casties
parents:
20
diff
changeset
|
327 */ |
|
03e0f7574224
saving and loading resource targets should work now (no searching yet)
casties
parents:
20
diff
changeset
|
328 public String getResourceUri() { |
|
48
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
329 if (resource == null) return null; |
|
0e00bf8e27fb
targets and resources of Annotation object are objects now.
casties
parents:
40
diff
changeset
|
330 return resource.getUri(); |
|
40
03e0f7574224
saving and loading resource targets should work now (no searching yet)
casties
parents:
20
diff
changeset
|
331 } |
|
03e0f7574224
saving and loading resource targets should work now (no searching yet)
casties
parents:
20
diff
changeset
|
332 |
|
03e0f7574224
saving and loading resource targets should work now (no searching yet)
casties
parents:
20
diff
changeset
|
333 /** |
| 9 | 334 * @return the creator |
| 335 */ | |
| 336 public Actor getCreator() { | |
| 337 return creator; | |
| 338 } | |
| 339 | |
| 340 /** | |
| 341 * @param creator the creator to set | |
| 342 */ | |
| 343 public void setCreator(Actor creator) { | |
| 344 this.creator = creator; | |
| 345 } | |
| 346 | |
| 347 /** | |
| 4 | 348 * @return the creatorUri |
| 349 */ | |
| 350 public String getCreatorUri() { | |
| 9 | 351 if (creator != null) { |
| 352 return creator.getUri(); | |
| 353 } | |
| 354 return null; | |
| 4 | 355 } |
| 356 | |
| 357 /** | |
| 5 | 358 * @return the creatorName |
| 359 */ | |
| 360 public String getCreatorName() { | |
| 9 | 361 if (creator != null) { |
| 362 return creator.getName(); | |
| 363 } | |
| 364 return null; | |
| 5 | 365 } |
| 366 | |
| 367 /** | |
| 4 | 368 * @return the created |
| 369 */ | |
| 370 public String getCreated() { | |
| 371 return created; | |
| 372 } | |
| 373 | |
| 374 /** | |
| 375 * @param created the created to set | |
| 376 */ | |
| 377 public void setCreated(String created) { | |
| 378 this.created = created; | |
| 379 } | |
| 10 | 380 |
|
95
acd44dfec9c8
added last update field for annotations in database.
casties
parents:
84
diff
changeset
|
381 public String getUpdated() { |
|
acd44dfec9c8
added last update field for annotations in database.
casties
parents:
84
diff
changeset
|
382 return updated; |
|
acd44dfec9c8
added last update field for annotations in database.
casties
parents:
84
diff
changeset
|
383 } |
|
acd44dfec9c8
added last update field for annotations in database.
casties
parents:
84
diff
changeset
|
384 |
|
acd44dfec9c8
added last update field for annotations in database.
casties
parents:
84
diff
changeset
|
385 public void setUpdated(String updated) { |
|
acd44dfec9c8
added last update field for annotations in database.
casties
parents:
84
diff
changeset
|
386 this.updated = updated; |
|
acd44dfec9c8
added last update field for annotations in database.
casties
parents:
84
diff
changeset
|
387 } |
|
acd44dfec9c8
added last update field for annotations in database.
casties
parents:
84
diff
changeset
|
388 |
|
acd44dfec9c8
added last update field for annotations in database.
casties
parents:
84
diff
changeset
|
389 /** |
| 10 | 390 * @return the adminPermission |
| 391 */ | |
| 392 public Actor getAdminPermission() { | |
|
20
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
393 if (adminPermission != null) { |
|
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
394 return adminPermission; |
|
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
395 } else { |
|
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
396 // if not specified then only creator is allowed |
|
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
397 return this.creator; |
|
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
398 } |
| 10 | 399 } |
| 400 | |
| 401 /** | |
| 402 * @param adminPermission the adminPermission to set | |
| 403 */ | |
| 404 public void setAdminPermission(Actor adminPermission) { | |
| 405 this.adminPermission = adminPermission; | |
| 406 } | |
| 407 | |
| 408 /** | |
| 409 * @return the deletePermission | |
| 410 */ | |
| 411 public Actor getDeletePermission() { | |
|
20
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
412 if (deletePermission != null) { |
|
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
413 return deletePermission; |
|
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
414 } else { |
|
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
415 // if not specified then only creator is allowed |
|
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
416 return this.creator; |
|
715aa11d138b
fixes in permission handling: admin and delete default to creator.
casties
parents:
16
diff
changeset
|
417 } |
| 10 | 418 } |
| 419 | |
| 420 /** | |
| 421 * @param deletePermission the deletePermission to set | |
| 422 */ | |
| 423 public void setDeletePermission(Actor deletePermission) { | |
| 424 this.deletePermission = deletePermission; | |
| 425 } | |
| 426 | |
| 427 /** | |
| 428 * @return the updatePermission | |
| 429 */ | |
| 430 public Actor getUpdatePermission() { | |
| 431 return updatePermission; | |
| 432 } | |
| 433 | |
| 434 /** | |
| 435 * @param updatePermission the updatePermission to set | |
| 436 */ | |
| 437 public void setUpdatePermission(Actor updatePermission) { | |
| 438 this.updatePermission = updatePermission; | |
| 439 } | |
| 440 | |
| 441 /** | |
| 442 * @return the readPermission | |
| 443 */ | |
| 444 public Actor getReadPermission() { | |
| 445 return readPermission; | |
| 446 } | |
| 447 | |
| 448 /** | |
| 449 * @param readPermission the readPermission to set | |
| 450 */ | |
| 451 public void setReadPermission(Actor readPermission) { | |
| 452 this.readPermission = readPermission; | |
| 453 } | |
| 16 | 454 |
| 455 /** | |
| 456 * @return the tags | |
| 457 */ | |
| 458 public Set<String> getTags() { | |
| 459 return tags; | |
| 460 } | |
| 461 | |
| 462 /** | |
| 463 * @param tags the tags to set | |
| 464 */ | |
| 465 public void setTags(Set<String> tags) { | |
| 466 this.tags = tags; | |
| 467 } | |
| 4 | 468 |
| 469 | |
| 470 } |
