1    /*
2     * Copyright 2008 :torweg free software group
3     * 
4     * This program is free software: you can redistribute it and/or modify
5     * it under the terms of the GNU General Public License as published by
6     * the Free Software Foundation, either version 3 of the License, or
7     * (at your option) any later version.
8     * 
9     * This program is distributed in the hope that it will be useful,
10    * but WITHOUT ANY WARRANTY; without even the implied warranty of
11    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    * GNU General Public License for more details.
13    * 
14    * You should have received a copy of the GNU General Public License
15    * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16    *
17    */
18   package org.torweg.pulse.component.core.accesscontrol.admin;
19   
20   import org.torweg.pulse.annotations.Action;
21   import org.torweg.pulse.annotations.Groups;
22   import org.torweg.pulse.annotations.Permission;
23   import org.torweg.pulse.annotations.RequireToken;
24   import org.torweg.pulse.bundle.Bundle;
25   import org.torweg.pulse.bundle.Controller;
26   import org.torweg.pulse.configuration.ConfigBean;
27   import org.torweg.pulse.configuration.DeprecatedConfigurable;
28   import org.torweg.pulse.service.event.XSLTOutputEvent;
29   import org.torweg.pulse.service.request.ServiceRequest;
30   
31   /**
32    * Initializes the WEST-Panel for the access-control of the <em>pulse</em>
33    * -web-site-administration.
34    * 
35    * @author Daniel Dietz
36    * @version $Revision: 1914 $
37    */
38   public class AccessControlEditor extends Controller implements DeprecatedConfigurable {
39   
40       /**
41        * the configuration.
42        */
43       private AccessControlEditorConfig config;
44   
45       /**
46        * Initializes the WEST-Panel within the <em>pulse</em>
47        * -web-site-administration.
48        * 
49        * @param bundle
50        *            the current {@code Bundle}
51        * @param request
52        *            the current {@code ServiceRequest}
53        * @return the initialization {@code Result} for the
54        *         {@code AccessControlEditor}
55        */
56       @RequireToken
57       @Action(value = "accessControlInit", generate = true)
58       @Permission("viewAccessControl")
59       @Groups(values = { "AccessControl:Administrator" })
60       public final AccessControlEditorResult initAccessControl(final Bundle bundle,
61               final ServiceRequest request) {
62           AccessControlEditorResult result = new AccessControlEditorResult();
63           XSLTOutputEvent event = new XSLTOutputEvent(this.config
64                   .getAjaxWestXSL());
65           event.setStopEvent(true);
66           request.getEventManager().addEvent(event);
67           return result;
68       }
69   
70       /**
71        * initializes the {@code AccessControlEditor}.
72        * 
73        * @param c
74        *            the {@code ConfigBean} of this {@code Controller}
75        */
76       public final void init(final ConfigBean c) {
77           this.config = (AccessControlEditorConfig) c;
78       }
79   
80   }
81