summaryrefslogtreecommitdiffstats
path: root/database
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2012-02-26 00:13:45 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2013-06-13 01:06:19 +0200
commit454d48a87c2005981885b29411ebca494cd77ea1 (patch)
tree11eb4398507033c7d80ba586ab74f11754e6655e /database
parentbb885e9db4127439e120a1556aea27de2f6b6c76 (diff)
downloadeurephia-454d48a87c2005981885b29411ebca494cd77ea1.tar.gz
eurephia-454d48a87c2005981885b29411ebca494cd77ea1.tar.xz
eurephia-454d48a87c2005981885b29411ebca494cd77ea1.zip
edb-pgsql: Added an update SQL view for eurephia_adminlog
This is to restrict the eurephia-admin database user to only be allowed to update a few fields of the eurephia_adminlog table. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Diffstat (limited to 'database')
-rw-r--r--database/postgresql/sql-schema.sql10
1 files changed, 10 insertions, 0 deletions
diff --git a/database/postgresql/sql-schema.sql b/database/postgresql/sql-schema.sql
index 6634344..67e8841 100644
--- a/database/postgresql/sql-schema.sql
+++ b/database/postgresql/sql-schema.sql
@@ -204,6 +204,16 @@ CREATE TABLE eurephia_adminlog (
CREATE INDEX eurephia_adminlog_uid ON eurephia_adminlog(uid);
CREATE INDEX eurephia_adminlog_sesskey ON eurephia_adminlog(sessionkey);
+CREATE VIEW eurephia_adminlog_update AS
+ SELECT sessionkey, status, last_action, logout
+ FROM eurephia_adminlog;
+CREATE RULE eurephia_adminlog_allow_update
+ AS ON UPDATE TO eurephia_adminlog_update
+ DO INSTEAD UPDATE eurephia_adminlog
+ SET status = NEW.status, last_action = NEW.last_action,
+ logout = NEW.logout
+ WHERE sessionkey = OLD.sessionkey;
+
-- Table eurephia_adminaccesss: Defines which modules eurephia users have access to.
-- The access is defined per user account. uid refers
-- to the user account in the users table.