1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.argeo.slc.client.ui.dist.wizards;
17
18 import javax.jcr.RepositoryException;
19 import javax.jcr.Session;
20
21 import org.argeo.jcr.JcrUtils;
22 import org.argeo.slc.SlcException;
23 import org.eclipse.jface.wizard.Wizard;
24
25
26
27
28
29 public class ChangeRightsWizard extends Wizard {
30
31 private Session currentSession;
32
33
34 private ChooseRightsPage page;
35
36 public ChangeRightsWizard(Session currentSession) {
37 super();
38 this.currentSession = currentSession;
39 }
40
41 @Override
42 public void addPages() {
43 try {
44 page = new ChooseRightsPage();
45 addPage(page);
46 } catch (Exception e) {
47 throw new SlcException("Cannot add page to wizard ", e);
48 }
49 }
50
51 @Override
52 public boolean performFinish() {
53 if (!canFinish())
54 return false;
55 try {
56 JcrUtils.addPrivilege(currentSession, "/", page.getGroupName(),
57 page.getAuthTypeStr());
58 } catch (RepositoryException re) {
59 throw new SlcException(
60 "Unexpected error while setting privileges", re);
61 }
62 return true;
63 }
64 }