001/**
002 *
003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either 
008 * version 2.1 of the License, or (at your option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013 * Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public 
016 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
017 * 
018 **/
019package lucee.runtime.security;
020
021
022import lucee.commons.io.res.Resource;
023import lucee.runtime.config.Config;
024import lucee.runtime.exp.PageException;
025
026
027/**
028 * interface for Security Manager
029 */
030public interface SecurityManager {
031
032        public final static short ACCESS_OPEN = 1;
033        public final static short ACCESS_PROTECTED = 2;
034        public final static short ACCESS_CLOSE = 3;
035
036    /**
037     * Field <code>TYPE_SETTING</code>
038     */
039    public final static int TYPE_SETTING = 0;
040
041    /**
042     * Field <code>TYPE_FILE</code>
043     */
044    public final static int TYPE_FILE = 1;
045
046    /**
047     * Field <code>TYPE_DIRECT_JAVA_ACCESS</code>
048     */
049    public final static int TYPE_DIRECT_JAVA_ACCESS = 2;
050
051    /**
052     * Field <code>TYPE_MAIL</code>
053     */
054    public final static int TYPE_MAIL = 3;
055
056    /**
057     * Field <code>TYPE_DATASOURCE</code>
058     */
059    public final static int TYPE_DATASOURCE = 4;
060
061    /**
062     * Field <code>TYPE_MAPPING</code>
063     */
064    public final static int TYPE_MAPPING = 5;
065
066    /**
067     * Field <code>TYPE_CUSTOM_TAG</code>
068     */
069    public final static int TYPE_CUSTOM_TAG = 6;
070
071    /**
072     * Field <code>TYPE_CFX_SETTING</code>
073     */
074    public final static int TYPE_CFX_SETTING = 7;
075
076    /**
077     * Field <code>TYPE_CFX_USAGE</code>
078     */
079    public final static int TYPE_CFX_USAGE = 8;
080
081    /**
082     * Field <code>TYPE_DEBUGGING</code>
083     */
084    public final static int TYPE_DEBUGGING = 9;
085
086    /**
087     * Field <code>TYPE_TAG_EXECUTE</code>
088     */
089    public static final int TYPE_TAG_EXECUTE = 10;
090
091    /**
092     * Field <code>TYPE_TAG_IMPORT</code>
093     */
094    public static final int TYPE_TAG_IMPORT = 11;
095
096    /**
097     * Field <code>TYPE_TAG_OBJECT</code>
098     */
099    public static final int TYPE_TAG_OBJECT = 12;
100
101    /**
102     * Field <code>TYPE_TAG_REGISTRY</code>
103     */
104    public static final int TYPE_TAG_REGISTRY = 13;
105
106    /**
107     * Field <code>TYPE_SEARCH</code>
108     */
109    public static final int TYPE_SEARCH = 14;
110
111    /**
112     * Field <code>TYPE_SCHEDULED_TASK</code>
113     */
114    public static final int TYPE_SCHEDULED_TASK = 15;
115    
116    public static final int TYPE_ACCESS_READ = 16;
117    public static final int TYPE_ACCESS_WRITE = 17;
118    public static final int TYPE_REMOTE = 18;
119    
120
121        public static final int TYPE_CACHE = 19;
122        public static final int TYPE_GATEWAY = 20;
123        public static final int TYPE_ORM = 21;
124
125    /**
126     * Field <code>VALUE_NO</code>
127     */
128    public final static short VALUE_NO = 0;
129
130    /**
131     * Field <code>VALUE_NONE</code>
132     */
133    public final static short VALUE_NONE = 0;
134
135    /**
136     * Field <code>VALUE_LOCAL</code>
137     */
138    public final static short VALUE_LOCAL = 1;
139
140    /**
141     * Field <code>VALUE_YES</code>
142     */
143    public final static short VALUE_YES = 2;
144
145    /**
146     * Field <code>VALUE_ALL</code>
147     */
148    public final static short VALUE_ALL = 2;
149    
150    
151    
152    
153
154    public final static short VALUE_1 = 11;
155    public final static short VALUE_2 = 12;
156    public final static short VALUE_3 = 13;
157    public final static short VALUE_4 = 14;
158    public final static short VALUE_5 = 15;
159    public final static short VALUE_6 = 16;
160    public final static short VALUE_7 = 17;
161    public final static short VALUE_8 = 18;
162    public final static short VALUE_9 = 19;
163    public final static short VALUE_10 = 20;
164    
165    public final static short NUMBER_OFFSET = 10;
166    
167    
168    
169
170    /**
171     * @param access
172     * @return return access value (all,local,none ...) for given type (cfx,file ...)
173     */
174    public abstract short getAccess(int access);
175
176    /**
177     * @param access
178     * @return return access value (all,local,none ...) for given type (cfx,file ...)
179     * @throws PageException
180     */
181    public abstract short getAccess(String access) throws PageException;
182
183    /**
184     * @param res
185     * @throws PageException
186     */
187    public abstract void checkFileLocation(Resource res) throws PageException;
188    
189    /**
190     * @param config
191     * @param res
192     * @param serverPassword
193     * @throws PageException
194     */
195    public abstract void checkFileLocation(Config config, Resource res, String serverPassword) throws PageException;
196
197    /**
198     * @return clone the security Manager
199     */
200    public abstract SecurityManager cloneSecurityManager();
201
202}