Browse Source

Add AGG_SERVICE_ACCOUNT to a new project

master
Maxime Wack 6 years ago
parent
commit
c115fac70f
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      R/pm.R

+ 4
- 0
R/pm.R View File

@@ -83,8 +83,12 @@ add_project <- function(project_id, project_name, host = "", admin = "", pass =
# Set the project id and name in pm_hive_data
RPostgreSQL::dbGetQuery(pm, stringr::str_c("INSERT INTO pm_project_data (project_id, project_name, project_wiki, project_path, status_cd) VALUES ('", project_id, "', '", project_name, "', 'http://www.i2b2.org', '/", project_id, "', 'A');"))

RPostgreSQL::dbGetQuery(hive, stringr::str_c("CREATE SCHEMA i2b2", project_id, "data;"))
RPostgreSQL::dbGetQuery(hive, stringr::str_c("CREATE DATABASE i2b2", project_id, "data WITH TEMPLATE i2b2demodata owner i2b2demodata;"))

# Add the AGG_SERVICE_ACCOUNT user to the project
RPostgreSQL::dbGetQuery(pm, stringr::str_c("INSERT INTO pm_project_user_roles (project_id, user_id, user_role_cd, status_cd) VALUES ('", project_id,"', 'AGG_SERVICE_ACCOUNT', 'USER', 'A'), ('", project_id,"', 'AGG_SERVICE_ACCOUNT', 'MANAGER', 'A'), ('", project_id,"', 'AGG_SERVICE_ACCOUNT', 'DATA_OBFSC', 'A'), ('", project_id,"', 'AGG_SERVICE_ACCOUNT', 'DATA_AGG', 'A');"))

# Disconnect the db
RPostgreSQL::dbDisconnect(hive)
RPostgreSQL::dbDisconnect(pm)


Loading…
Cancel
Save