Added UserInfo and UserAuth tables

This commit is contained in:
Nikolaos Laskaris 2017-10-12 16:57:52 +02:00
parent c795b030ee
commit 2709e8ba54
1 changed files with 35 additions and 8 deletions

View File

@ -447,20 +447,47 @@ ALTER TABLE ONLY "DatasetService"
ADD CONSTRAINT "DatasetServiceServiceReference" FOREIGN KEY ("Service") REFERENCES "Service"("ID");
DROP table if exists "UserInfo";
CREATE TABLE "UserInfo" (
"autoid" uuid DEFAULT uuid_generate_v4() NOT NULL,
"id" character varying(500),
"email" character varying(250),
"emailIsVerified" boolean,
"identification" character varying(500) NOT NULL,
"email" character varying(250) NOT NULL,
"authorization_level" smallint NOT NULL,
"usertype" smallint NOT NULL,
"authentication" uuid,
"verified_email" boolean,
"name" character varying(250),
"pictureUrl" character varying(500),
"locale" character varying(50),
"familyName" character varying(250),
"givenName" character varying(250),
"created" timestamp,
"lastloggedin" timestamp,
"additionalinfo" xml,
PRIMARY KEY (id, email)
PRIMARY KEY (identification, email)
);
COMMENT ON COLUMN "UserInfo"."authorization_level" IS 'This stores the authorization level of the user: 0 admin, 1 user, being able to be extended furthermore';
COMMENT ON COLUMN "UserInfo"."usertype" IS 'This stores the type of user: 0 -> internal, 1 external';
DROP table if exists "UserAuth";
CREATE TABLE "UserAuth" (
"id" uuid DEFAULT uuid_generate_v4() NOT NULL,
"username" character varying(200) NOT NULL,
"password" character varying(250) NOT NULL,
PRIMARY KEY (id)
);
CREATE INDEX idx_userauth_username ON "UserAuth"(username);
ALTER TABLE "UserInfo" ADD CONSTRAINT fkey_userinfo_userauth FOREIGN KEY ("authentication") REFERENCES "UserAuth"(id);
COMMENT ON COLUMN "UserAuth"."password" IS 'This field stores a password hash';
ALTER TABLE "UserInfo" OWNER TO dmptool;
ALTER TABLE "UserAuth" OWNER TO dmptool;
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;