Skip to content

Commit

Permalink
[ODS-6602] Database changes - API only allows tenant1's profiles when…
Browse files Browse the repository at this point in the history
… different profiles are set up for different tenants (#1212)
  • Loading branch information
mjaksn authored and semalaiappan committed Jan 28, 2025
1 parent 4d242b0 commit eaa6813
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- SPDX-License-Identifier: Apache-2.0
-- Licensed to the Ed-Fi Alliance under one or more agreements.
-- The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
-- See the LICENSE and NOTICES files in the project root for more information.

ALTER TABLE dbo.Profiles
ALTER COLUMN ProfileName NVARCHAR(500) NOT NULL
GO

ALTER TABLE dbo.Profiles DROP CONSTRAINT IF EXISTS UQ_Profiles_ProfileName;
ALTER TABLE dbo.Profiles ADD CONSTRAINT UQ_Profiles_ProfileName UNIQUE (ProfileName);
GO
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
-- SPDX-License-Identifier: Apache-2.0
-- Licensed to the Ed-Fi Alliance under one or more agreements.
-- The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
-- See the LICENSE and NOTICES files in the project root for more information.
DO $$
BEGIN

DROP VIEW IF EXISTS dbo.apiclientidentityrawdetails;

ALTER TABLE IF EXISTS dbo.profiles
ALTER COLUMN profilename TYPE character varying(500) COLLATE pg_catalog."default";

ALTER TABLE dbo.profiles DROP CONSTRAINT IF EXISTS profiles_profilename_key;
ALTER TABLE dbo.profiles ADD CONSTRAINT profiles_profilename_key UNIQUE (profilename);

CREATE OR REPLACE VIEW dbo.apiclientidentityrawdetails
AS
SELECT ac.key,
ac.usesandbox,
ac.studentidentificationsystemdescriptor,
aeo.educationorganizationid,
app.claimsetname,
vnp.namespaceprefix,
p.profilename,
ac.creatorownershiptokenid_ownershiptokenid AS creatorownershiptokenid,
acot.ownershiptoken_ownershiptokenid AS ownershiptokenid,
ac.apiclientid,
ac.secret,
ac.secretishashed
FROM dbo.apiclients ac
JOIN dbo.applications app ON app.applicationid = ac.application_applicationid
LEFT JOIN dbo.vendors v ON v.vendorid = app.vendor_vendorid
LEFT JOIN dbo.vendornamespaceprefixes vnp ON v.vendorid = vnp.vendor_vendorid
LEFT JOIN dbo.apiclientapplicationeducationorganizations acaeo ON acaeo.apiclient_apiclientid = ac.apiclientid
LEFT JOIN dbo.applicationeducationorganizations aeo ON aeo.applicationeducationorganizationid = acaeo.applicationedorg_applicationedorgid
LEFT JOIN dbo.profileapplications ap ON ap.application_applicationid = app.applicationid
LEFT JOIN dbo.profiles p ON p.profileid = ap.profile_profileid
LEFT JOIN dbo.apiclientownershiptokens acot ON ac.apiclientid = acot.apiclient_apiclientid;

ALTER TABLE dbo.apiclientidentityrawdetails
OWNER TO postgres;

END $$;

0 comments on commit eaa6813

Please sign in to comment.