1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package com.xpn.xwiki.plugin.rightsmanager

File RightsManagerPlugin.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart9.png
38% of files have more coverage

Code metrics

2
6
3
1
86
31
4
0.67
2
3
1.33

Classes

Class Line # Actions
RightsManagerPlugin 39 6 0% 4 1
0.9090909490.9%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20   
21    package com.xpn.xwiki.plugin.rightsmanager;
22   
23    import org.slf4j.Logger;
24    import org.slf4j.LoggerFactory;
25    import org.xwiki.observation.ObservationManager;
26   
27    import com.xpn.xwiki.XWikiContext;
28    import com.xpn.xwiki.plugin.XWikiDefaultPlugin;
29    import com.xpn.xwiki.plugin.XWikiPluginInterface;
30    import com.xpn.xwiki.web.Utils;
31   
32    /**
33    * Entry point of the Rights Manager plugin.
34    *
35    * @version $Id: c567dfb0d970444ec0d9120e9c55576de3b5ec56 $
36    * @since 1.1.2
37    * @since 1.2M2
38    */
 
39    public class RightsManagerPlugin extends XWikiDefaultPlugin
40    {
41    /**
42    * Identifier of Wiki Manager plugin.
43    */
44    public static final String PLUGIN_NAME = "rightsmanager";
45   
46    // ////////////////////////////////////////////////////////////////////////////
47   
48    /**
49    * The logging tool.
50    */
51    protected static final Logger LOGGER = LoggerFactory.getLogger(RightsManagerPlugin.class);
52   
53    // ////////////////////////////////////////////////////////////////////////////
54   
55    /**
56    * Construct the entry point of the Rights Manager plugin.
57    *
58    * @param name the identifier of the plugin.
59    * @param className the class name of the entry point of the plugin.
60    * @param context the XWiki context.
61    */
 
62  3 toggle public RightsManagerPlugin(String name, String className, XWikiContext context)
63    {
64  3 super(PLUGIN_NAME, className, context);
65    }
66   
 
67  3 toggle @Override
68    public void init(XWikiContext context)
69    {
70    // Register a listener so that the RightsManager is called when a document with a XWikiUsers object is
71    // removed in order to remove that user from its groups.
72    // Make sure we allow this plugin to be initialized several times in a row; i.e. don't re-register the
73    // listener if it's already registered.
74  3 RightsManagerListener rightsManagerListener = RightsManagerListener.getInstance();
75  3 ObservationManager observationManager = Utils.getComponent(ObservationManager.class);
76  3 if (observationManager.getListener(rightsManagerListener.getName()) == null) {
77  3 observationManager.addListener(rightsManagerListener);
78    }
79    }
80   
 
81  22 toggle @Override
82    public com.xpn.xwiki.api.Api getPluginApi(XWikiPluginInterface plugin, XWikiContext context)
83    {
84  22 return new RightsManagerPluginApi((RightsManagerPlugin) plugin, context);
85    }
86    }