Commit 72a69ce2 authored by Michael Hanus 's avatar Michael Hanus

Adds private data dir to generated Spicey application

parent 1146d499
--- Some global configurations for the Spicey application.
module Config.Spicey
where
--- Location of the directory containing private run-time data
--- such as session and authentication information.
spiceyDataDir :: String
spiceyDataDir = "data"
......@@ -74,6 +74,8 @@ deploy: checkdeploy
$(CPM) exec $(MAKECGI) -standalone -m main -o $(WEBSERVERDIR)/spicey.cgi Main.curry
# copy other files (style sheets, images,...)
cp -r public/* $(WEBSERVERDIR)
mkdir -p $(WEBSERVERDIR)/data # create private data dir
cp -p data/htaccess $(WEBSERVERDIR)/data/.htaccess # and make it private
chmod -R go+rX $(WEBSERVERDIR)
# clean up generated the package directory
......
......@@ -13,11 +13,14 @@ module System.Session (
getSessionData, putSessionData, removeSessionData
) where
import HTML.Base
import Time
import FilePath ( (</>) )
import Global
import List
import Time
import HTML.Base
import Config.Spicey ( spiceyDataDir )
import System.Crypto
--- The life span in minutes to store data in sessions.
......@@ -32,7 +35,7 @@ sessionCookieName = "spiceySessionId"
--- This global value saves time and last session id.
lastId :: Global (Int, Int)
lastId = global (0, 0) (Persistent sessionCookieName)
lastId = global (0, 0) (Persistent (spiceyDataDir </> sessionCookieName))
--- The abstract type to represent session identifiers.
......
......@@ -14,7 +14,11 @@ module System.SessionInfo (
getUserSessionInfo, updateUserSessionInfo
) where
import FilePath ( (</>) )
import Global
import Config.Spicey ( spiceyDataDir )
import System.Session
--------------------------------------------------------------------------
......@@ -39,7 +43,8 @@ setUserLoginOfSession login (SD _) = SD login
--------------------------------------------------------------------------
--- Definition of the session state to store the login name (as a string).
userSessionInfo :: Global (SessionStore UserSessionInfo)
userSessionInfo = global emptySessionStore (Persistent "userSessionInfo")
userSessionInfo =
global emptySessionStore (Persistent (spiceyDataDir </> "userSessionInfo"))
--- Gets the data of the current user session.
getUserSessionInfo :: IO UserSessionInfo
......
AuthType Basic
AuthName Spicey
AuthUserFile /dev/null
AuthGroupFile /dev/null
<Limit GET>
<IfVersion < 2.3>
# old access rules
order deny,allow
deny from all
satisfy any
#allow from 127.0.0.
</IfVersion>
<IfVersion >= 2.3>
# new access rules via authz_mod_core
Require all denied
#Require local
</IfVersion>
</Limit>
......@@ -5,6 +5,7 @@
"synopsis": "Web application 'XXXPKGNAMEXXX' generated by Spicey",
"category": [ "Web" ],
"dependencies": {
"base" : ">= 1.0.0, < 2.0.0",
"cdbi" : ">= 2.0.0",
"html" : ">= 2.1.0",
"wui" : ">= 2.0.0"
......
......@@ -16,7 +16,7 @@ import Spicey.Scaffolding
systemBanner :: String
systemBanner =
let bannerText = "Spicey Web Framework (Version " ++ packageVersion ++
" of 24/11/18)"
" of 25/11/18)"
bannerLine = take (length bannerText) (repeat '-')
in bannerLine ++ "\n" ++ bannerText ++ "\n" ++ bannerLine
......@@ -55,18 +55,22 @@ spiceyStructure pkgname =
ResourceFile NoExec "Processes.curry",
GeneratedFromERD createAuthorizations ],
Directory "View" [
ResourceFile NoExec ("View" </> "SpiceySystem.curry"),
ResourceFile NoExec $ "View" </> "SpiceySystem.curry",
GeneratedFromERD createViews,
GeneratedFromERD createHtmlHelpers ],
Directory "Controller" [
ResourceFile NoExec ("Controller" </> "SpiceySystem.curry"),
ResourceFile NoExec $ "Controller" </> "SpiceySystem.curry",
GeneratedFromERD createControllers ],
Directory "Model" [
GeneratedFromERD createModels ],
Directory "Config" [
ResourceFile NoExec "UserProcesses.curry",
ResourceFile NoExec $ "Config" </> "Spicey.curry",
ResourceFile NoExec $ "Config" </> "UserProcesses.curry",
GeneratedFromERD createRoutes ]
],
Directory "data" [
ResourceFile NoExec $ "data" </> "htaccess"
],
Directory "public" [
ResourceFile NoExec "index.html",
ResourceFile NoExec "favicon.ico",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment