version: 0.1
approval status: APPROVED
source: https://github.com/matthias-springer/elfinder-grails-plugin
submitted by matthias.spring 1 year ago

elfinder-grails-plugin ====================== This Grails plugin integrates elFinder (https://github.com/Studio-42/elFinder) by wrapping the existing elFinder servlets (https://github.com/Studio-42/elfinder-servlet). Installation ------------ * Install the plugin * Use tag `````` to include elfinder. * In your ```Config.groovy```, specify the home directory, i.e. the directory accessible with elfinder: ```elfinder.homeSharedDocs = "/tmp/shared"``` Integrate with CKEditor ----------------------- Use ```ckeditor``` attribute (e.g. ``````) and follow these instructions to configure CKEditor: https://github.com/Studio-42/elFinder/wiki/Integration-with-CKEditor Authentication / Authorization ------------------------------ In your ```Config.groovy```, set ```elfinder.authentication```. It must implement the ```org.elfinder.ServletAuthentication``` interface. You have to implement the method ```public boolean isAllowed(HttpServletRequest request)``` that returns true iff access should be granted. *Important:* read access via ```virtualproxy``` servlet is always granted. ```elfinder.authentication``` applies only to write, delete, ... Here is an example how to integrate Spring Security. ```groovy // Integration of Spring Security Core in elfinder servlets elfinder.authentication = new org.elfinder.ServletAuthentication() { private final static String SECURITY_ROLE = 'ROLE_ADMIN' @Override public boolean isAllowed(HttpServletRequest request) { def ctx = SCH.servletContext.getAttribute(GA.APPLICATION_CONTEXT) def sessionId = request.cookies.find({cookie -> cookie.name == "JSESSIONID"}).value try { return ctx.sessionRegistry.getSessionInformation(sessionId).getPrincipal().getAuthorities().find({auth -> auth.getAuthority() == SECURITY_ROLE}) != null } catch (Exception e) { // invalid session cookie provided return false } } } ```

blog comments powered by Disqus