001    package railo.runtime.functions.file;
002    
003    import java.io.IOException;
004    
005    import railo.commons.io.ModeUtil;
006    import railo.commons.io.res.Resource;
007    import railo.runtime.PageContext;
008    import railo.runtime.exp.PageException;
009    import railo.runtime.op.Caster;
010    
011    public class FileSetAccessMode {
012    
013            public static String call(PageContext pc, Object oSrc, String strMode) throws PageException {
014                    Resource src = Caster.toResource(oSrc,false);
015                    pc.getConfig().getSecurityManager().checkFileLocation(src);
016                    try {
017                            src.setMode(ModeUtil.toOctalMode(strMode));
018                    } 
019                    catch (IOException e) {
020                            throw Caster.toPageException(e);
021                    }
022                    return null;
023            }
024    }