View Javadoc

1   package org.apache.turbine.om.security;
2   
3   /*
4    * Copyright 2001-2004 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,v 1.4.2.2 2004/05/20 03:05:17 seade Exp $
33   */
34  public class TurbinePermission extends SecurityObject implements Permission
35  {
36      /***
37       * Constructs a new TurbinePermission.
38       */
39      public TurbinePermission()
40      {
41          super();
42      }
43  
44      /***
45       * Constructs a new TurbinePermission with the sepcified name.
46       *
47       * @param name The name of the new object.
48       */
49      public TurbinePermission(String name)
50      {
51          super(name);
52      }
53  
54      /***
55       * Makes changes made to the Permission attributes permanent.
56       *
57       * @throws TurbineSecurityException if there is a problem while saving data.
58       */
59      public void save() throws TurbineSecurityException
60      {
61          TurbineSecurity.savePermission(this);
62      }
63  
64      /***
65       * not implemented
66       *
67       * @param conn
68       * @throws Exception
69       */
70      public void save(Connection conn) throws Exception
71      {
72          throw new Exception("not implemented");
73      }
74  
75      /***
76       * not implemented
77       *
78       * @param dbname
79       * @throws Exception
80       */
81      public void save(String dbname) throws Exception
82      {
83          throw new Exception("not implemented");
84      }
85  
86      /***
87       * Removes a permission from the system.
88       *
89       * @throws TurbineSecurityException if the Permission could not be removed.
90       */
91      public void remove() throws TurbineSecurityException
92      {
93          TurbineSecurity.removePermission(this);
94      }
95  
96      /***
97       * Renames the permission.
98       *
99       * @param name The new Permission name.
100      * @throws TurbineSecurityException if the Permission could not be renamed.
101      */
102     public void rename(String name) throws TurbineSecurityException
103     {
104         TurbineSecurity.renamePermission(this, name);
105     }
106 }