New Customer Checklist: Difference between revisions

From Bitnami MediaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(46 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Checklist for Logging into New Customer Novus/Shell Databases
Checklist for Logging into New Customer Novus/Shell Databases


:1. Check [Identity].dbo.domain has a domain record. Run the following query:
:<strong>1.</strong> Check [Identity].dbo.domain has a domain record. Run the following query:
  <nowiki>       SELECT   *
  <nowiki> SELECT *
        FROM     [Identity].dbo.domain d
FROM [Identity].dbo.domain d
        WHERE     d.name = 'foobar.com';</nowiki>
WHERE d.name = 'foobar.com';</nowiki>
::If it doesn’t exist, run the following INSERT:
::If it doesn’t exist, run the following INSERT:
  <nowiki>       INSERT   INTO [Identity].dbo.domain
  <nowiki> INSERT [Identity].dbo.domain
                  (name
(name
                  ,release_number)
,release_number)
        VALUES   ('foobar.com', -- name
VALUES ('foobar.com' -- name
                  ,'2022.5.2.0'); -- release_number</nowiki>
,'2022.5.2.0'); -- release_number</nowiki>
#Check [Identity].dbo.domain_database has two records with IDs: SHELL and NOVUS:
SELECT db.*
:<strong>2.</strong> Check [Identity].dbo.domain_database has two records with IDs: SHELL and NOVUS:
FROM [Identity].dbo.domain d
<nowiki> SELECT db.*
  INNER JOIN [Identity].dbo.domain_database db ON d.domain_key = db.domain_key
FROM [Identity].dbo.domain d
WHERE d.name = 'foobar.com';
INNER JOIN [Identity].dbo.domain_database db ON d.domain_key = db.domain_key
If they do not exist, then they have to be inserted. We need to generate the encrypted user ID and password for the SQL login for the customer’s SHELL and NOVUS databases. Open the Visual Studio project, in the Novus.IdentityServer project, in the Startup class, temporarily modify the Configure() method to the below, and set the SQL login user ID or password at textToEncrypt to get the encrypted string of the user ID or password:
WHERE d.name = 'foobar.com';</nowiki>
public void Configure(IApplicationBuilder app)
{
  // ...


  /* run any StartupOneOffMethods temporarily */
::If they do not exist, then they have to be inserted. We need to generate the encrypted user ID and password for the SQL login for the customer’s SHELL and NOVUS databases. Open the Visual Studio project, in the Novus.IdentityServer project, in the Startup class, temporarily modify the Configure() method to the below, and set the SQL login user ID or password at textToEncrypt to get the encrypted string of the user ID or password:
<nowiki> public void Configure(IApplicationBuilder app)
{
// ...


  var oneOffMethods = new StartupOneOffMethods(app);
/* run any StartupOneOffMethods temporarily */
  Debug.WriteLine(oneOffMethods.AesEncrypt("textToEncrypt").encryptedString);
}
For example, if the text is “Password1”, then the output will be “VxXhYh/bH2IHo/ZGZEHl5w==”.
Execute the below UPDATE two times: (1) for the Shell database by setting @id = 'SHELL' and @database to the Shell database e.g. 'FoobarShellQA'; and (2) for the Novus database by setting @id = 'NOVUS' and @database to the Novus database e.g. 'FoobarNovusQA'. Leave the @environment as NULL for production or set it to a specific environment to connect to a different database e.g. 'QA'. Set @server to the hostname or IP address of SQL Server Set @userId and @password to the encrypted SQL login user credentials generated previously.
DECLARE @domain varchar(253) = 'foobar.com';
DECLARE @id varchar(20) = '';
DECLARE @environment varchar(20) = NULL;
DECLARE @server varchar(200) = 'localhost';
DECLARE @database varchar(200) = '';
DECLARE @userId varchar(200) = 'zpfimVI/pFs10wUYAqU3ig==';
DECLARE @password varchar(200) = 'eWRsvEZpFxJt6KmvMk0f/A==';
DECLARE @cssFiles varchar(50) = NULL; -- values: NULL, 'qa', 'uat'


INSERT INTO [Identity].dbo.domain_database (domain_key,id,environment,server,[database],trusted_connection,user_id,password,css_files) VALUES (
var oneOffMethods = new StartupOneOffMethods(app);
  (SELECT domain_key FROM [Identity].dbo.domain WHERE name = @domain), -- domain_key,
Debug.WriteLine(oneOffMethods.AesEncrypt("textToEncrypt").encryptedString);
  @id, -- id,
}</nowiki>
  @environment, -- environment,
  @server, -- server,
  @database, -- [database],
  (CASE WHEN @userId IS NOT NULL AND @userId <> '' THEN 0 ELSE 1 END), -- trusted_connection,
  @userId, -- user_id,
  @password, -- password,
  @cssFiles -- css_files
);
2a) Check if [Identity].dbo.domain_ssrs record exists by running the following query:
SELECT ssrs.*
FROM [Identity].dbo.domain_ssrs ssrs
  INNER JOIN [Identity].dbo.domain d ON ssrs.domain_key = d.domain_key
WHERE d.name = 'foobar.com';
If it doesn’t exist, run the following INSERT:
DECLARE @domain varchar(253) = 'foobar.com';
DECLARE @environment varchar(20) = NULL;
DECLARE @server varchar(200) = 'localhost';
DECLARE @database varchar(200) = 'FoobarNovusQA';


INSERT INTO [Identity].dbo.domain_ssrs (domain_key,id,environment,server,[database]) VALUES (
::For example, if the text is “Password1”, then the output will be “VxXhYh/bH2IHo/ZGZEHl5w==”.
  (SELECT domain_key FROM [Identity].dbo.domain WHERE name = @domain), -- domain_key,
 
  'NOVUS', -- id,
::Execute the below UPDATE two times: (1) for the Shell database by setting @id = 'SHELL' and @database to the Shell database e.g. 'FoobarShellQA'; and (2) for the Novus database by setting @id = 'NOVUS' and @database to the Novus database e.g. 'FoobarNovusQA'. Leave the @environment as NULL for production or set it to a specific environment to connect to a different database e.g. 'QA'. Set @server to the hostname or IP address of SQL Server Set @userId and @password to the encrypted SQL login user credentials generated previously.
  @environment, -- environment,
 
  @server, -- server,
<nowiki> DECLARE @domain varchar(253) = 'kiwana.com'
  @database -- [database]
,@id varchar(20) = 'NOVUS'
);
,@environment varchar(20) = 'KiwanaNovus'
3) Check if Identity user record exists by running the following query:
,@environmentLabel varchar(20) = 'Production'
SELECT *
,@server varchar(200) = '10.50.3.5'
FROM [Identity].dbo.[user] u
,@database varchar(200) = 'KiwanaNovus'
WHERE u.user_id = 'admin@foobar.com';
,@userId varchar(200) = 'zpfimVI/pFs10wUYAqU3ig=='
If it doesn’t exist, run the following INSERT:
,@password varchar(200) = 'cuNyOp/oTgKSC5A9IA2bXMi7LP1X2kShRYtQUTFz2To='
INSERT INTO [Identity].dbo.[user] (user_id,email,is_active,normalized_username,normalized_email) VALUES (
,@cssFiles varchar(50) = NULL; -- values: NULL, 'qa', 'uat'
  'admin@foobar.com', -- user_id,
 
  'visfuture@foobar.com', -- email,
INSERT [Identity].dbo.domain_database
  1, -- is_active,
(domain_key
  UPPER('admin@foobar.com'), -- normalized_username,
,id
  UPPER('visfuture@foobar.com') -- normalized_email
,environment
);
,environment_label
4) If you cannot log in, nullify the password by running the following UPDATE:
,server
UPDATE [Identity].dbo.[user]
,[database]
SET password_hash = NULL
,trusted_connection
WHERE user_id = 'admin@foobar.com';
,user_id
Then log in with password admin.
,password
5) Check if SHELL user record exists by running the following query:
,css_files)
SELECT u.*
VALUES ((SELECT domain_key
FROM Shell.dbo.sec_user u
FROM [Identity].dbo.domain
WHERE u.user_id = 'admin';
WHERE name = @domain) -- domain_key
If it doesn’t exist, run the following INSERT:
,@id -- id
INSERT INTO Shell.dbo.sec_user (user_id,first_name,last_name,email,default_company,default_branch,default_warehouse,is_active,is_administrator,created_on,created_by,version) VALUES (
,@environment -- environment
    'admin', -- user_id,
,@environmentLabel --environment label
    'Admin', -- first_name,
,@server -- server
    '', -- last_name,
,@database -- [database]
    'visfuture@foobar.com', -- email,
,(CASE
    '1', -- default_company,
WHEN @userId IS NOT NULL AND @userId <> '' THEN 0
    '1', -- default_branch,
ELSE 1
    '1', -- default_warehouse,
END) -- trusted_connection
    1, -- is_active,
,@userId -- user_id
    1, -- is_administrator,
,@password -- password
    GETUTCDATE(), -- created_on,
,@cssFiles) -- css_files  </nowiki>
    SYSTEM_USER, -- created_by,
 
    0 -- version
:<strong>2a.</strong> Check if [Identity].dbo.domain_ssrs record exists by running the following query:
);
 
6) Should be good now. If you can log in but the list of applications is not showing up, if could due to the following:
<nowiki> SELECT ssrs.*
If a database in domain_database was misspelled and then corrected, run the following cURL (for UAT) command to reset the tenant cache (see section for more details): curl -v -X POST -H 'Content-Length:0' -H 'IdentityServerApiSecret:<cF9[3kYxXSGwr2&' https://novusuatapi.kiwanatechnologies.com/api/tenant/clear
FROM [Identity].dbo.domain_ssrs ssrs
The novususer SQL login doesn’t have access permission to the “Shell” or “Novus” database. You can quickly check if this is the case by opening SSMS, expand the database, and see if you can query a database table inside.
INNER JOIN [Identity].dbo.domain d ON ssrs.domain_key = d.domain_key
WHERE d.name = 'foobar.com'; </nowiki>
::If it doesn’t exist, run the following INSERT:
 
<nowiki> DECLARE @domain varchar(253) = 'Kiwana.com'
,@environment varchar(20) = 'KiwanaNovus'
,@server varchar(200) = '10.50.3.5'
,@database varchar(200) = 'KiwanaNovus'
 
INSERT [Identity].dbo.domain_ssrs
(domain_key
,id
,environment
,server
,[database])
VALUES ((SELECT domain_key
FROM [Identity].dbo.domain
WHERE name = @domain) -- domain_key
,'NOVUS' -- id
,@environment -- environment
,@server -- server
,@database) -- database </nowiki>
 
:<strong>3.</strong> Check if Identity user record exists by running the following query:
 
<nowiki> SELECT *
FROM [Identity].dbo.[user] u
WHERE u.user_id = 'admin@foobar.com'; </nowiki>
 
::If it doesn’t exist, run the following INSERT:
 
<nowiki> INSERT [Identity].dbo.[user]
(user_id
,email
,is_active
,normalized_username
,normalized_email)
VALUES ('admin@kiwana.com' -- user_id
,'support@kiwanatechnologies.com' -- email
,1 -- is_active
,UPPER ('admin@kiwana.com') -- normalized_username
,UPPER ('support@kiwanatechnologies.com')) -- normalized_email) </nowiki>
:<strong>4.</strong> If you cannot log in, nullify the password by running the following UPDATE:
 
<nowiki> UPDATE [Identity].dbo.[user]
SET password_hash = NULL
WHERE user_id = 'admin@foobar.com'; </nowiki>
 
::Then log in with password admin.
 
:<strong>5.</strong> Check if SHELL user record exists by running the following query:
 
<nowiki> SELECT u.*
FROM Shell.dbo.sec_user u
WHERE u.user_id = 'admin'; </nowiki>
::If it doesn’t exist, run the following INSERT:
 
<nowiki> INSERT Shell.dbo.sec_user
(user_id
,first_name
,last_name
,email
,default_company
,default_branch
,default_warehouse
,is_active
,is_administrator
,created_on
,created_by
,version)
VALUES ('admin' -- user_id
,'Admin' -- first_name
,'' -- last_name
,'visfuture@foobar.com' -- email
,'1' -- default_company
,'1' -- default_branch
,'1' -- default_warehouse
,1 -- is_active
,1 -- is_administrator
,GETUTCDATE() -- created_on
,SYSTEM_USER -- created_by
,0 -- version); </nowiki>
:<strong>6.</strong> Should be good now. If you can log in but the list of applications is not showing up, if could due to the following:
 
:*If a database in domain_database was misspelled and then corrected, run the following cURL (for UAT) command to reset the tenant cache (see section for more details): curl -v -X POST -H 'Content-Length:0' -H 'IdentityServerApiSecret:<cF9[3kYxXSGwr2&' https://novusuatapi.kiwanatechnologies.com/api/tenant/clear
:*The novususer SQL login doesn’t have access permission to the “Shell” or “Novus” database. You can quickly check if this is the case by opening SSMS, expand the database, and see if you can query a database table inside.
 
 
<strong>Return to [[Novus]]</strong>

Latest revision as of 18:35, 10 March 2025

Checklist for Logging into New Customer Novus/Shell Databases

1. Check [Identity].dbo.domain has a domain record. Run the following query:
	SELECT	*
	FROM	[Identity].dbo.domain d
	WHERE	d.name = 'foobar.com';
If it doesn’t exist, run the following INSERT:
	INSERT	[Identity].dbo.domain
		(name
		,release_number)
	VALUES	('foobar.com'	-- name
		,'2022.5.2.0');	-- release_number
2. Check [Identity].dbo.domain_database has two records with IDs: SHELL and NOVUS:
	SELECT	db.*
	FROM	[Identity].dbo.domain d
	INNER	JOIN [Identity].dbo.domain_database db ON d.domain_key = db.domain_key
	WHERE	d.name = 'foobar.com';
If they do not exist, then they have to be inserted. We need to generate the encrypted user ID and password for the SQL login for the customer’s SHELL and NOVUS databases. Open the Visual Studio project, in the Novus.IdentityServer project, in the Startup class, temporarily modify the Configure() method to the below, and set the SQL login user ID or password at textToEncrypt to get the encrypted string of the user ID or password:
	public void Configure(IApplicationBuilder app)
	{
	// ...

	/* run any StartupOneOffMethods temporarily */

	var oneOffMethods = new StartupOneOffMethods(app);
	Debug.WriteLine(oneOffMethods.AesEncrypt("textToEncrypt").encryptedString);
	}
For example, if the text is “Password1”, then the output will be “VxXhYh/bH2IHo/ZGZEHl5w==”.
Execute the below UPDATE two times: (1) for the Shell database by setting @id = 'SHELL' and @database to the Shell database e.g. 'FoobarShellQA'; and (2) for the Novus database by setting @id = 'NOVUS' and @database to the Novus database e.g. 'FoobarNovusQA'. Leave the @environment as NULL for production or set it to a specific environment to connect to a different database e.g. 'QA'. Set @server to the hostname or IP address of SQL Server Set @userId and @password to the encrypted SQL login user credentials generated previously.
	DECLARE	@domain				varchar(253)	= 'kiwana.com'
		,@id				varchar(20)		= 'NOVUS'
		,@environment		varchar(20)		= 'KiwanaNovus'
		,@environmentLabel	varchar(20)		= 'Production'
		,@server			varchar(200)	= '10.50.3.5'
		,@database			varchar(200)	= 'KiwanaNovus'
		,@userId			varchar(200)	= 'zpfimVI/pFs10wUYAqU3ig=='
		,@password			varchar(200)	= 'cuNyOp/oTgKSC5A9IA2bXMi7LP1X2kShRYtQUTFz2To='
		,@cssFiles			varchar(50)		= NULL; -- values: NULL, 'qa', 'uat'

INSERT	[Identity].dbo.domain_database
		(domain_key
		,id
		,environment
		,environment_label
		,server
		,[database]
		,trusted_connection
		,user_id
		,password
		,css_files)
VALUES	((SELECT	domain_key
		FROM		[Identity].dbo.domain
		WHERE		name = @domain)	-- domain_key
		,@id				-- id
		,@environment		-- environment
		,@environmentLabel	--environment label
		,@server			-- server
		,@database			-- [database]
		,(CASE
			WHEN @userId IS NOT NULL AND @userId <> '' THEN 0 
			ELSE 1
		END)				-- trusted_connection
		,@userId			-- user_id
		,@password			-- password
		,@cssFiles)			-- css_files  
2a. Check if [Identity].dbo.domain_ssrs record exists by running the following query:
	SELECT	ssrs.*
	FROM	[Identity].dbo.domain_ssrs ssrs
	INNER JOIN [Identity].dbo.domain d ON ssrs.domain_key = d.domain_key
	WHERE	d.name = 'foobar.com'; 
If it doesn’t exist, run the following INSERT:
	DECLARE	@domain			varchar(253)	= 'Kiwana.com'
		,@environment	varchar(20)		= 'KiwanaNovus'
		,@server		varchar(200)	= '10.50.3.5'
		,@database		varchar(200)	= 'KiwanaNovus'

INSERT	[Identity].dbo.domain_ssrs
		(domain_key
		,id
		,environment
		,server
		,[database])
VALUES	((SELECT	domain_key
		FROM	[Identity].dbo.domain
		WHERE	name = @domain)	-- domain_key
		,'NOVUS'				-- id
		,@environment			-- environment
		,@server				-- server
		,@database)				-- database 
3. Check if Identity user record exists by running the following query:
	SELECT	*
	FROM	[Identity].dbo.[user] u
	WHERE	u.user_id	= 'admin@foobar.com'; 
If it doesn’t exist, run the following INSERT:
	INSERT	[Identity].dbo.[user]
		(user_id
		,email
		,is_active
		,normalized_username
		,normalized_email)
VALUES	('admin@kiwana.com'							-- user_id
		,'support@kiwanatechnologies.com'			-- email
		,1											-- is_active
		,UPPER ('admin@kiwana.com')					-- normalized_username
		,UPPER ('support@kiwanatechnologies.com'))	-- normalized_email) 
4. If you cannot log in, nullify the password by running the following UPDATE:
	UPDATE	[Identity].dbo.[user]
	SET	password_hash = NULL
	WHERE	user_id = 'admin@foobar.com'; 
Then log in with password admin.
5. Check if SHELL user record exists by running the following query:
	SELECT	u.*
	FROM	Shell.dbo.sec_user u
	WHERE	u.user_id = 'admin'; 
If it doesn’t exist, run the following INSERT:
	INSERT	Shell.dbo.sec_user
		(user_id
		,first_name
		,last_name
		,email
		,default_company
		,default_branch
		,default_warehouse
		,is_active
		,is_administrator
		,created_on
		,created_by
		,version)
	VALUES	('admin'		-- user_id
		,'Admin'		-- first_name
		,''			-- last_name
		,'visfuture@foobar.com'	-- email
		,'1'			-- default_company
		,'1'			-- default_branch
		,'1'			-- default_warehouse
		,1			-- is_active
		,1			-- is_administrator
		,GETUTCDATE()		-- created_on
		,SYSTEM_USER		-- created_by
		,0			-- version); 
6. Should be good now. If you can log in but the list of applications is not showing up, if could due to the following:
  • If a database in domain_database was misspelled and then corrected, run the following cURL (for UAT) command to reset the tenant cache (see section for more details): curl -v -X POST -H 'Content-Length:0' -H 'IdentityServerApiSecret:<cF9[3kYxXSGwr2&' https://novusuatapi.kiwanatechnologies.com/api/tenant/clear
  • The novususer SQL login doesn’t have access permission to the “Shell” or “Novus” database. You can quickly check if this is the case by opening SSMS, expand the database, and see if you can query a database table inside.


Return to Novus