View Javadoc

1   package org.apache.turbine.om.security;
2   
3   /*
4    * Copyright 2001-2005 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License")
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import java.sql.Connection;
20  import org.apache.turbine.services.security.TurbineSecurity;
21  import org.apache.turbine.util.security.TurbineSecurityException;
22  
23  /***
24   * This class represents the permissions that a Role has to access
25   * certain pages/functions within the system.  The class implements
26   * Comparable so that when Permissions are added to a Set, they will
27   * be in alphabetical order by name.
28   *
29   * @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
30   * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
31   * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
32   * @version $Id: TurbinePermission.java 278822 2005-09-05 19:53:05Z henning $
33   */
34  public class TurbinePermission extends SecurityObject implements Permission
35  {
36      /*** Serial Version UID */
37      private static final long serialVersionUID = -2193700445644560143L;
38  
39      /***
40       * Constructs a new TurbinePermission.
41       */
42      public TurbinePermission()
43      {
44          super();
45      }
46  
47      /***
48       * Constructs a new TurbinePermission with the sepcified name.
49       *
50       * @param name The name of the new object.
51       */
52      public TurbinePermission(String name)
53      {
54          super(name);
55      }
56  
57      /***
58       * Makes changes made to the Permission attributes permanent.
59       *
60       * @throws TurbineSecurityException if there is a problem while saving data.
61       */
62      public void save() throws TurbineSecurityException
63      {
64          TurbineSecurity.savePermission(this);
65      }
66  
67      /***
68       * not implemented
69       *
70       * @param conn
71       * @throws Exception
72       */
73      public void save(Connection conn) throws Exception
74      {
75          throw new Exception("not implemented");
76      }
77  
78      /***
79       * not implemented
80       *
81       * @param dbname
82       * @throws Exception
83       */
84      public void save(String dbname) throws Exception
85      {
86          throw new Exception("not implemented");
87      }
88  
89      /***
90       * Removes a permission from the system.
91       *
92       * @throws TurbineSecurityException if the Permission could not be removed.
93       */
94      public void remove() throws TurbineSecurityException
95      {
96          TurbineSecurity.removePermission(this);
97      }
98  
99      /***
100      * Renames the permission.
101      *
102      * @param name The new Permission name.
103      * @throws TurbineSecurityException if the Permission could not be renamed.
104      */
105     public void rename(String name) throws TurbineSecurityException
106     {
107         TurbineSecurity.renamePermission(this, name);
108     }
109 }