    001    package org.apache.turbine.om.security;
    002
    003
    004    /*
    005     * Licensed to the Apache Software Foundation (ASF) under one
    006     * or more contributor license agreements.  See the NOTICE file
    007     * distributed with this work for additional information
    008     * regarding copyright ownership.  The ASF licenses this file
    009     * to you under the Apache License, Version 2.0 (the
    010     * "License"); you may not use this file except in compliance
    011     * with the License.  You may obtain a copy of the License at
    012     *
    013     *   http://www.apache.org/licenses/LICENSE-2.0
    014     *
    015     * Unless required by applicable law or agreed to in writing,
    016     * software distributed under the License is distributed on an
    017     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    018     * KIND, either express or implied.  See the License for the
    019     * specific language governing permissions and limitations
    020     * under the License.
    021     */
    022
    023
    024    import java.sql.Connection;
    025
    026    import org.apache.turbine.services.security.TurbineSecurity;
    027    import org.apache.turbine.util.security.TurbineSecurityException;
    028
    029    /**
    030     * This class represents the permissions that a Role has to access
    031     * certain pages/functions within the system.  The class implements
    032     * Comparable so that when Permissions are added to a Set, they will
    033     * be in alphabetical order by name.
    034     *
    035     * @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
    036     * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
    037     * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
    038     * @version $Id: TurbinePermission.java 1078552 2011-03-06 19:58:46Z tv $
    039     */
    040    public class TurbinePermission extends SecurityObject<Permission> implements Permission
    041    {
    042        /** Serial version */
    043        private static final long serialVersionUID = -2193700445644560143L;
    044
    045        /**
    046         * Constructs a new TurbinePermission.
    047         */
    048        public TurbinePermission()
    049        {
    050            super();
    051        }
    052
    053        /**
    054         * Constructs a new TurbinePermission with the sepcified name.
    055         *
    056         * @param name The name of the new object.
    057         */
    058        public TurbinePermission(String name)
    059        {
    060            super(name);
    061        }
    062
    063        /**
    064         * Makes changes made to the Permission attributes permanent.
    065         *
    066         * @throws TurbineSecurityException if there is a problem while saving data.
    067         */
    068        public void save() throws TurbineSecurityException
    069        {
    070            TurbineSecurity.savePermission(this);
    071        }
    072
    073        /**
    074         * not implemented
    075         *
    076         * @param conn
    077         * @throws Exception
    078         */
    079        public void save(Connection conn) throws Exception
    080        {
    081            throw new Exception("not implemented");
    082        }
    083
    084        /**
    085         * not implemented
    086         *
    087         * @param dbname
    088         * @throws Exception
    089         */
    090        public void save(String dbname) throws Exception
    091        {
    092            throw new Exception("not implemented");
    093        }
    094
    095        /**
    096         * Removes a permission from the system.
    097         *
    098         * @throws TurbineSecurityException if the Permission could not be removed.
    099         */
    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    }