Changeset 1310
- Timestamp:
- Mar 4, 2011, 3:45:04 PM (12 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/README
r1301 r1310 20 20 installation. Otherwise, just wait a bit and the automatic installation will 21 21 find and install the new extension. 22 5. Log in as a user with Administrator priviliges. Go to the Extensions->Reggie 23 menu. Select the 'Verify/install required annotation types and other items' 24 wizard and create the required items. If the 'Reggie' menu is not visible 25 try BASE->Reload permissions menu. 26 6. Done. 22 5. Log in as a user with Administrator priviliges. 23 6. Create a project and set it as the active project. This step is 24 optional but is recommended. Running Reggie without an active project 25 will generate warning messages later on. 26 7. Go to the Extensions->Reggie menu. Select the 'Verify/install required 27 annotation types and other items' wizard. If the 'Reggie' menu is not 28 visible try BASE->Reload permissions menu. 29 8. It should display a list with several error message about missing items. 30 Click on the "Create missing items" button to create them. If no project 31 was created in step 6, all annotatation types will be shared with the 32 'PatientCurator' group, otherwise only some will be shared to the 33 group and some will be shared to the active project. 34 9. Done. 27 35 28 36 -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java
r1309 r1310 25 25 import net.sf.basedb.core.Permission; 26 26 import net.sf.basedb.core.Project; 27 import net.sf.basedb.core.ProjectKey; 27 28 import net.sf.basedb.core.SessionControl; 28 29 import net.sf.basedb.core.SharedItem; … … 83 84 } 84 85 85 // Annotation type checks 86 PermissionOptions sharedToActiveProject = null; 87 int projectId = dc.getSessionControl().getActiveProjectId(); 88 if (projectId != 0) 89 { 90 sharedToActiveProject = new PermissionOptions(); 91 sharedToActiveProject.set(Project.getById(dc, projectId), Permission.USE); 92 } 93 94 // Annotation type checks 95 // -- the first batch need to be shared to the PatientCurator group 86 96 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_PERSONAL_NUMBER, Item.BIOSOURCE, Type.STRING, 1, 87 97 null, sharedToPatientCurator, createIfMissing)); … … 90 100 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_ALL_FIRST_NAMES, Item.BIOSOURCE, Type.STRING, 1, 91 101 null, sharedToPatientCurator, createIfMissing)); 102 103 // -- the second batch need only be shared to the active project or to the PatientCurator group 104 PermissionOptions effectiveOptions = sharedToActiveProject == null ? 105 sharedToPatientCurator : sharedToActiveProject; 106 92 107 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_DATE_OF_BIRTH, Item.BIOSOURCE, Type.DATE, 1, 93 null, sharedToPatientCurator, createIfMissing));108 null, effectiveOptions, createIfMissing)); 94 109 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_GENDER, Item.BIOSOURCE, Type.STRING, 1, 95 new EnumerationOptions("F", "M"), sharedToPatientCurator, createIfMissing));110 new EnumerationOptions("F", "M"), effectiveOptions, createIfMissing)); 96 111 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_LATERALITY, Item.SAMPLE, Type.STRING, 1, 97 new EnumerationOptions("LEFT", "RIGHT"), sharedToPatientCurator, createIfMissing));112 new EnumerationOptions("LEFT", "RIGHT"), effectiveOptions, createIfMissing)); 98 113 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_REASON_IF_NO_SPECIMEN, Item.SAMPLE, Type.STRING, 0, 99 null, sharedToPatientCurator, createIfMissing));114 null, effectiveOptions, createIfMissing)); 100 115 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_PAD, Item.SAMPLE, Type.STRING, 1, 101 null, sharedToPatientCurator, createIfMissing));116 null, effectiveOptions, createIfMissing)); 102 117 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_PAD_CASE, Item.SAMPLE, Type.STRING, 0, 103 null, sharedToPatientCurator, createIfMissing));118 null, effectiveOptions, createIfMissing)); 104 119 105 120 json.put("checks", jsonChecks); … … 381 396 { 382 397 private Map<Group, Permission> groupPermissions; 398 private Map<Project, Permission> projectPermissions; 383 399 private String message; 384 400 … … 386 402 { 387 403 groupPermissions = new HashMap<Group, Permission>(); 404 projectPermissions = new HashMap<Project, Permission>(); 388 405 } 389 406 … … 394 411 { 395 412 groupPermissions.put(g, p); 413 } 414 415 /** 416 Set a permission for the given project. 417 */ 418 void set(Project pr, Permission p) 419 { 420 projectPermissions.put(pr, p); 396 421 } 397 422 … … 403 428 boolean checkPermissions(SharedItem item) 404 429 { 430 ProjectKey pKey = item.getProjectKey(); 431 for (Map.Entry<Project, Permission> entry : projectPermissions.entrySet()) 432 { 433 Project pr = entry.getKey(); 434 Permission p = entry.getValue(); 435 if (pKey == null || !pKey.getPermissions(pr).contains(p)) 436 { 437 message = "Not shared to project: " + pr.getName() + " (" + p + ")"; 438 return false; 439 } 440 } 405 441 ItemKey key = item.getItemKey(); 406 442 for (Map.Entry<Group, Permission> entry : groupPermissions.entrySet()) … … 414 450 return false; 415 451 } 416 417 452 } 418 453 return true; … … 439 474 mp.addPermissions(g, Collections.singleton(p)); 440 475 } 476 for (Map.Entry<Project, Permission> entry : projectPermissions.entrySet()) 477 { 478 Project pr = entry.getKey(); 479 Permission p = entry.getValue(); 480 mp.addPermissions(pr, Collections.singleton(p)); 481 } 441 482 mp.updateKeys(item.getDbControl()); 442 483 }
Note: See TracChangeset
for help on using the changeset viewer.