View Javadoc

1   /*
2    * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3    * Copyright (C) 2004-2010 Frederico Caldeira Knabben
4    * 
5    * == BEGIN LICENSE ==
6    * 
7    * Licensed under the terms of any of the following licenses at your
8    * choice:
9    * 
10   *  - GNU General Public License Version 2 or later (the "GPL")
11   *    http://www.gnu.org/licenses/gpl.html
12   * 
13   *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14   *    http://www.gnu.org/licenses/lgpl.html
15   * 
16   *  - Mozilla Public License Version 1.1 or later (the "MPL")
17   *    http://www.mozilla.org/MPL/MPL-1.1.html
18   * 
19   * == END LICENSE ==
20   */
21  package net.fckeditor.requestcycle;
22  
23  import javax.servlet.http.HttpServletRequest;
24  
25  import net.fckeditor.handlers.Command;
26  
27  /**
28   * An interface for user action control. In particular, this interface gives
29   * you fine-grained control over the File Browser {@link Command commands}.
30   * <p>
31   * <strong>Note:</strong> You are free to implement this interface the way you
32   * need it, in other words your return values can be global, regardless of the
33   * request, or on a per-request basis.
34   * </p>
35   * 
36   * @version $Id: UserAction.java 4785 2009-12-21 20:10:28Z mosipov $
37   */
38  public interface UserAction {
39  
40  	/**
41  	 * Checks if file upload is enabled/allowed. This method maps to
42  	 * {@link Command#FILE_UPLOAD FileUpload} and {@link Command#QUICK_UPLOAD
43  	 * QuickUpload}.<br />
44  	 * <strong>Note:</strong> This method may be renamed to {@code
45  	 * isFileUploadEnabled} in future versions.
46  	 * 
47  	 * @param request
48  	 *            current user request instance
49  	 * @return {@code true} if file upload is enabled/allowed, else {@code
50  	 *         false}
51  	 */
52  	public boolean isEnabledForFileUpload(final HttpServletRequest request);
53  
54  	/**
55  	 * Checks if resource retrieval/listing is enabled/allowed. This method maps
56  	 * to {@link Command#GET_FOLDERS GetFolders} and
57  	 * {@link Command#GET_FOLDERS_AND_FILES GetFoldersAndFiles}.<br />
58  	 * <strong>Note:</strong> This method may be renamed to {@code
59  	 * isGetResourcesEnabled} in future versions.
60  	 * 
61  	 * @param request
62  	 *            current user request instance
63  	 * @return {@code true} if resource retrieval/listing is enabled/allowed,
64  	 *         else {@code false}
65  	 */
66  	public boolean isEnabledForFileBrowsing(final HttpServletRequest request);
67  
68  	/**
69  	 * Checks if folder creation is enabled/allowed. This method maps to
70  	 * {@link Command#CREATE_FOLDER CreateFolder}.
71  	 * 
72  	 * @param request
73  	 *            current user request instance
74  	 * @return {@code true} if folder creation is enabled/allowed, else {@code
75  	 *         false}
76  	 */
77  	public boolean isCreateFolderEnabled(final HttpServletRequest request);
78  
79  }