Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/xpn/xwiki/api/Api.java


1   /**
2    * ===================================================================
3    *
4    * Copyright (c) 2003 Ludovic Dubost, All rights reserved.
5    *
6    * This program is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU General Public License
8    * as published by the Free Software Foundation; either version 2
9    * of the License, or (at your option) any later version.
10   *
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU General Public License for more details, published at
15   * http://www.gnu.org/copyleft/gpl.html or in gpl.txt in the
16   * root folder of this distribution.
17   *
18   * User: ludovic
19   * Date: 15 mars 2004
20   * Time: 01:54:43
21   */
22  
23  package com.xpn.xwiki.api;
24  
25  import com.xpn.xwiki.XWikiContext;
26  import com.xpn.xwiki.XWikiException;
27  import com.xpn.xwiki.doc.XWikiDocument;
28  
29  public class Api {
30      protected XWikiContext context;
31  
32      public Api(XWikiContext context) {
33         this.context = context;
34      }
35  
36      public boolean checkProgrammingRights() {
37          return hasProgrammingRights();
38      }
39  
40      public boolean hasProgrammingRights() {
41              com.xpn.xwiki.XWiki xwiki = context.getWiki();
42              return xwiki.getRightService().hasProgrammingRights(context);
43      }
44  
45      public boolean hasAdminRights() {
46              com.xpn.xwiki.XWiki xwiki = context.getWiki();
47              return xwiki.getRightService().hasAdminRights(context);
48      }
49  
50      public boolean hasAccessLevel(String right, String docname) throws XWikiException {
51          com.xpn.xwiki.XWiki xwiki = context.getWiki();
52          return xwiki.getRightService().hasAccessLevel(right, context.getUser(), docname, context);        
53      }
54  
55  }