-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Private datasets Can be toggled via the web interface. Private status determines who can view and manipulate datasets via the web interface. It does not encrypt data or anything like it. * Fix template references to owner
- Loading branch information
Showing
14 changed files
with
267 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Add 'is_deactivated' column to user table | ||
import sys | ||
import os | ||
|
||
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)) + "'/../..") | ||
from common.lib.database import Database | ||
from common.lib.logger import Logger | ||
|
||
import config | ||
|
||
log = Logger(output=True) | ||
db = Database(logger=log, dbname=config.DB_NAME, user=config.DB_USER, password=config.DB_PASSWORD, host=config.DB_HOST, | ||
port=config.DB_PORT, appname="4cat-migrate") | ||
|
||
print(" Checking if datasets table has a column 'is_private'...") | ||
has_column = db.fetchone("SELECT COUNT(*) AS num FROM information_schema.columns WHERE table_name = 'datasets' AND column_name = 'is_private'") | ||
if has_column["num"] == 0: | ||
print(" ...No, adding.") | ||
db.execute("ALTER TABLE datasets ADD COLUMN is_private BOOLEAN DEFAULT TRUE") | ||
db.commit() | ||
|
||
# make existing datasets all non-private, as they were before | ||
db.execute("UPDATE datasets SET is_private = FALSE") | ||
db.commit() | ||
else: | ||
print(" ...Yes, nothing to update.") | ||
|
||
print(" Checking if datasets table has a column 'owner'...") | ||
has_column = db.fetchone("SELECT COUNT(*) AS num FROM information_schema.columns WHERE table_name = 'datasets' AND column_name = 'owner'") | ||
if has_column["num"] == 0: | ||
print(" ...No, adding.") | ||
db.execute("ALTER TABLE datasets ADD COLUMN owner VARCHAR DEFAULT 'anonymous'") | ||
db.commit() | ||
|
||
# make existing datasets all non-private, as they were before | ||
db.execute("UPDATE datasets SET owner = parameters::json->>'user' WHERE parameters::json->>'user' IS NOT NULL") | ||
db.commit() | ||
else: | ||
print(" ...Yes, nothing to update.") | ||
|
||
|
||
print(" Done!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.