View Javadoc

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