User Management - Support new object types: Server Role, Application Role and Database Role (#22889)

* server role dialogs

* dialogs for other types

* refactor

* find object dialog

* script button

* refactoring

* fix issues

* fix title

* vbump sts

* remove language from links
This commit is contained in:
Alan Ren
2023-04-28 12:05:20 -07:00
committed by GitHub
parent ba09248483
commit 4f53d76eb5
18 changed files with 1411 additions and 480 deletions

View File

@@ -0,0 +1,70 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export function equals(one: any, other: any, strictArrayCompare: boolean = true): boolean {
if (one === other) {
return true;
}
if (one === null || one === undefined || other === null || other === undefined) {
return false;
}
if (typeof one !== typeof other) {
return false;
}
if (typeof one !== 'object') {
return false;
}
if ((Array.isArray(one)) !== (Array.isArray(other))) {
return false;
}
let i: number;
let key: string;
if (Array.isArray(one)) {
if (one.length !== other.length) {
return false;
}
for (i = 0; i < one.length; i++) {
if (strictArrayCompare) {
if (!equals(one[i], other[i], strictArrayCompare)) {
return false;
}
} else {
let match = false;
for (let j = 0; j < other.length; j++) {
if (equals(one[i], other[j], strictArrayCompare)) {
match = true;
break;
}
}
if (!match) {
return false;
}
}
}
} else {
const oneKeys: string[] = [];
for (key in one) {
oneKeys.push(key);
}
oneKeys.sort();
const otherKeys: string[] = [];
for (key in other) {
otherKeys.push(key);
}
otherKeys.sort();
if (!equals(oneKeys, otherKeys, strictArrayCompare)) {
return false;
}
for (i = 0; i < oneKeys.length; i++) {
if (!equals(one[oneKeys[i]], other[oneKeys[i]], strictArrayCompare)) {
return false;
}
}
}
return true;
}