View Javadoc

1   /*
2    *  ginp - Java Web Application for Viewing Photo Collections
3    *  Copyright (C) 2004  Douglas John Culnane <doug@culnane.net>
4    *
5    *  This library is free software; you can redistribute it and/or
6    *  modify it under the terms of the GNU Lesser General Public
7    *  License as published by the Free Software Foundation; either
8    *  version 2.1 of the License, or any later version.
9    *
10   *  This library 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 library; if not, write to the Free Software
17   *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18   */
19  package net.sf.ginp.commands;
20  
21  import java.util.Vector;
22  
23  import net.sf.ginp.GinpModel;
24  
25  /**
26   *  Class to proccess request to change state to Administration Mode.
27   *
28   *@author     Doug Culnane
29   *@version    $Revision: 264 $
30   */
31  public class AdminMode implements Command {
32  
33      /**
34       *  Description of the Method
35       *
36       *@param  model   Description of the Parameter
37       *@param  params  Description of the Parameter
38       */
39      public void action(GinpModel model, Vector params) {
40  
41          String  userFeeback  = "";
42          if (model.getCollection() != null) {
43              // security check
44              if (!model.getCollection().userHasWriteAccess()) {
45                  userFeeback = model.translate("txtNoRights");
46              }
47  
48              // go back to admin page.
49              model.setCurrentPage("admin.jsp?message=" + userFeeback);
50          }
51      }
52  }
53