update cql files

This commit is contained in:
2025-07-27 13:55:45 +02:00
parent 7a3c338e2b
commit d86b6f07e4
2 changed files with 65 additions and 6 deletions

View File

@@ -1,6 +1,63 @@
-- Create a keyspace
CREATE KEYSPACE IF NOT EXISTS device_configuration
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
-- Role: role_administrator
-- DROP ROLE role_administrator;
CREATE ROLE role_administrator WITH LOGIN = false AND SUPERUSER = false;
-- Use the keyspace
USE device_configuration;
-- Role: role_service
-- DROP ROLE role_service;
CREATE ROLE role_service WITH LOGIN = false AND SUPERUSER = false;
-- Role: role_maintainer
-- DROP ROLE role_maintainer;
CREATE ROLE role_maintainer WITH LOGIN = false AND SUPERUSER = false;
-- Role: role_support
-- DROP ROLE role_support;
CREATE ROLE role_support WITH LOGIN = false AND SUPERUSER = false;
-- Owner administrator
-- DROP ROLE administrator;
CREATE ROLE administrator WITH PASSWORD = 'password' AND LOGIN = true;
GRANT role_administrator TO administrator;
-- Owner service
-- DROP ROLE service;
CREATE ROLE service WITH PASSWORD = 'password' AND LOGIN = true;
GRANT role_service TO service;
-- Owner maintainer
-- DROP ROLE maintainer;
CREATE ROLE maintainer WITH PASSWORD = 'password' AND LOGIN = true;
GRANT role_maintainer TO maintainer;
-- Owner support
-- DROP ROLE support;
CREATE ROLE support WITH PASSWORD = 'password' AND LOGIN = true;
GRANT role_support TO support;
-- Keyspace
-- DROP KEYSPACE device_configuration;
CREATE KEYSPACE device_configuration
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}
AND durable_writes = true;
-- Revoke all permissions from existing roles
-- REVOKE ALL PERMISSIONS ON KEYSPACE device_configuration FROM role_administrator;
-- REVOKE ALL PERMISSIONS ON KEYSPACE device_configuration FROM role_service;
-- REVOKE ALL PERMISSIONS ON KEYSPACE device_configuration FROM role_maintainer;
-- REVOKE ALL PERMISSIONS ON KEYSPACE device_configuration FROM role_support;
-- Grant permissions
GRANT ALL PERMISSIONS ON KEYSPACE device_configuration TO role_administrator;
GRANT SELECT, MODIFY ON KEYSPACE device_configuration TO role_service;
GRANT SELECT, MODIFY ON KEYSPACE device_configuration TO role_maintainer;
GRANT SELECT ON KEYSPACE device_configuration TO role_support;