Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0669db5
feat: Add Role-Based Feature Visibility system (App Profiles + Platfo…
Jun 24, 2026
7fc44c2
fix: replace SelectQueryStruct with PreparedStatement in AppProfileUtils
Jun 24, 2026
159b8ae
fix: add GetPlatformProfileUsers reactor and utility method
Jun 24, 2026
6b1b4b3
feat: multi-profile, group profiles, delegated BU admin, and reactor …
Jun 25, 2026
888d3e7
fix: group profile base features propagate to subgroup members; expan…
Jun 25, 2026
00f8ded
Merge branch 'dev' into feat/ui-profiles-rework
ppatel9703 Jun 25, 2026
7fbde12
refactor(profiles): move util classes to reactor packages, add Javado…
Jun 25, 2026
eae6d39
Merge branch 'dev' into feat/ui-profiles-rework
ppatel9703 Jun 26, 2026
b57d4e8
refactor(profiles): reorganize appprofile reactors into sub-packages …
Jun 26, 2026
391ade8
feat: bulk user assignment for Assign reactors (assigned/skipped/errors)
Jun 26, 2026
90eb7e2
refactor(appprofile): remove group/subgroup model, flatten app profiles
Jun 26, 2026
9ab5859
Merge branch 'dev' into feat/ui-profiles-rework
ppatel9703 Jun 29, 2026
f3b95ec
Merge branch 'dev' into feat/ui-profiles-rework
ppatel9703 Jul 6, 2026
f3e24e9
Merge branch 'dev' into feat/ui-profiles-rework
themaherkhalil Jul 7, 2026
a99ea4b
Merge branch 'dev' into feat/ui-profiles-rework
themaherkhalil Jul 8, 2026
cdc020b
Merge branch 'dev' into feat/ui-profiles-rework
themaherkhalil Jul 8, 2026
688eca8
Merge branch 'dev' into feat/ui-profiles-rework
themaherkhalil Jul 9, 2026
d898810
Merge branch 'dev' into feat/ui-profiles-rework
themaherkhalil Jul 9, 2026
525e72f
Merge branch 'dev' into feat/ui-profiles-rework
themaherkhalil Jul 12, 2026
9ca8158
Merge branch 'dev' into feat/ui-profiles-rework
ppatel9703 Jul 13, 2026
959d934
Merge branch 'dev' into feat/ui-profiles-rework
ppatel9703 Jul 14, 2026
2a7585b
Merge branch 'dev' into feat/ui-profiles-rework
ppatel9703 Jul 16, 2026
89ac8d4
Merge branch 'dev' into feat/ui-profiles-rework
ppatel9703 Jul 17, 2026
a21ebbd
Merge branch 'dev' into feat/ui-profiles-rework
ppatel9703 Jul 20, 2026
2c3e98e
Merge branch 'dev' into feat/ui-profiles-rework
ppatel9703 Jul 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
301 changes: 301 additions & 0 deletions src/prerna/auth/utils/AbstractSecurityUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2404,6 +2404,307 @@ public static void initialize() throws Exception {
}
}

// APP_PROFILE — named profiles per app
colNames = new String[] { "PROFILE_ID", "APP_ID", "PROFILE_NAME", "DESCRIPTION", "IS_DEFAULT", "IS_GROUP", "CREATED_BY", "CREATED_AT" };
types = new String[] { "VARCHAR(255)", "VARCHAR(255)", "VARCHAR(255)", "VARCHAR(2000)", BOOLEAN_DATATYPE_NAME, BOOLEAN_DATATYPE_NAME, "VARCHAR(255)", TIMESTAMP_DATATYPE_NAME };
defaultValues = new Object[] { null, null, null, null, false, false, null, null };
if (allowIfExistsTable) {
String sql = queryUtil.createTableIfNotExistsWithDefaults("APP_PROFILE", colNames, types, defaultValues);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
} else {
if (!queryUtil.tableExists(conn, "APP_PROFILE", database, schema)) {
String sql = queryUtil.createTable("APP_PROFILE", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
}
}
{
List<String> allCols = queryUtil.getTableColumns(conn, "APP_PROFILE", database, schema);
for (int i = 0; i < colNames.length; i++) {
String col = colNames[i];
if (!allCols.contains(col) && !allCols.contains(col.toLowerCase())) {
classLogger.info("Column '{}' is not present in current list of columns: {}", col, allCols);
String addColumnSql = queryUtil.alterTableAddColumn("APP_PROFILE", col, types[i]);
classLogger.info("Running sql {}", addColumnSql);
securityDb.insertData(addColumnSql);
}
}
}

// APP_FEATURE — feature key definitions per app
colNames = new String[] { "FEATURE_ID", "APP_ID", "FEATURE_KEY", "DESCRIPTION", "CREATED_BY", "CREATED_AT" };
types = new String[] { "VARCHAR(255)", "VARCHAR(255)", "VARCHAR(255)", "VARCHAR(2000)", "VARCHAR(255)", TIMESTAMP_DATATYPE_NAME };
if (allowIfExistsTable) {
String sql = queryUtil.createTableIfNotExists("APP_FEATURE", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
} else {
if (!queryUtil.tableExists(conn, "APP_FEATURE", database, schema)) {
String sql = queryUtil.createTable("APP_FEATURE", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
}
}
{
List<String> allCols = queryUtil.getTableColumns(conn, "APP_FEATURE", database, schema);
for (int i = 0; i < colNames.length; i++) {
String col = colNames[i];
if (!allCols.contains(col) && !allCols.contains(col.toLowerCase())) {
classLogger.info("Column '{}' is not present in current list of columns: {}", col, allCols);
String addColumnSql = queryUtil.alterTableAddColumn("APP_FEATURE", col, types[i]);
classLogger.info("Running sql {}", addColumnSql);
securityDb.insertData(addColumnSql);
}
}
}

// APP_PROFILE_FEATURE — which features are ON per profile (missing row = OFF)
colNames = new String[] { "APP_ID", "PROFILE_ID", "FEATURE_ID", "ENABLED" };
types = new String[] { "VARCHAR(255)", "VARCHAR(255)", "VARCHAR(255)", BOOLEAN_DATATYPE_NAME };
defaultValues = new Object[] { null, null, null, true };
if (allowIfExistsTable) {
String sql = queryUtil.createTableIfNotExistsWithDefaults("APP_PROFILE_FEATURE", colNames, types, defaultValues);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
} else {
if (!queryUtil.tableExists(conn, "APP_PROFILE_FEATURE", database, schema)) {
String sql = queryUtil.createTable("APP_PROFILE_FEATURE", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
}
}
{
List<String> allCols = queryUtil.getTableColumns(conn, "APP_PROFILE_FEATURE", database, schema);
for (int i = 0; i < colNames.length; i++) {
String col = colNames[i];
if (!allCols.contains(col) && !allCols.contains(col.toLowerCase())) {
classLogger.info("Column '{}' is not present in current list of columns: {}", col, allCols);
String addColumnSql = queryUtil.alterTableAddColumn("APP_PROFILE_FEATURE", col, types[i]);
classLogger.info("Running sql {}", addColumnSql);
securityDb.insertData(addColumnSql);
}
}
}

// APP_USER_PROFILE — user-to-profile assignment per app (one per user per app)
colNames = new String[] { "APP_ID", "USER_ID", "PROFILE_ID", "ASSIGNED_BY", "ASSIGNED_AT" };
types = new String[] { "VARCHAR(255)", "VARCHAR(255)", "VARCHAR(255)", "VARCHAR(255)", TIMESTAMP_DATATYPE_NAME };
if (allowIfExistsTable) {
String sql = queryUtil.createTableIfNotExists("APP_USER_PROFILE", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
} else {
if (!queryUtil.tableExists(conn, "APP_USER_PROFILE", database, schema)) {
String sql = queryUtil.createTable("APP_USER_PROFILE", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
}
}
{
List<String> allCols = queryUtil.getTableColumns(conn, "APP_USER_PROFILE", database, schema);
for (int i = 0; i < colNames.length; i++) {
String col = colNames[i];
if (!allCols.contains(col) && !allCols.contains(col.toLowerCase())) {
classLogger.info("Column '{}' is not present in current list of columns: {}", col, allCols);
String addColumnSql = queryUtil.alterTableAddColumn("APP_USER_PROFILE", col, types[i]);
classLogger.info("Running sql {}", addColumnSql);
securityDb.insertData(addColumnSql);
}
}
}

// PLATFORM_PROFILE — named platform-level profiles
colNames = new String[] { "PROFILE_ID", "PROFILE_NAME", "DESCRIPTION", "CREATED_BY", "CREATED_AT" };
types = new String[] { "VARCHAR(255)", "VARCHAR(255)", "VARCHAR(2000)", "VARCHAR(255)", TIMESTAMP_DATATYPE_NAME };
if (allowIfExistsTable) {
String sql = queryUtil.createTableIfNotExists("PLATFORM_PROFILE", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
} else {
if (!queryUtil.tableExists(conn, "PLATFORM_PROFILE", database, schema)) {
String sql = queryUtil.createTable("PLATFORM_PROFILE", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
}
}
{
List<String> allCols = queryUtil.getTableColumns(conn, "PLATFORM_PROFILE", database, schema);
for (int i = 0; i < colNames.length; i++) {
String col = colNames[i];
if (!allCols.contains(col) && !allCols.contains(col.toLowerCase())) {
classLogger.info("Column '{}' is not present in current list of columns: {}", col, allCols);
String addColumnSql = queryUtil.alterTableAddColumn("PLATFORM_PROFILE", col, types[i]);
classLogger.info("Running sql {}", addColumnSql);
securityDb.insertData(addColumnSql);
}
}
}

// PLATFORM_PROFILE_FEATURE — predefined nav keys ON/OFF per platform profile
colNames = new String[] { "PROFILE_ID", "FEATURE_KEY", "ENABLED" };
types = new String[] { "VARCHAR(255)", "VARCHAR(100)", BOOLEAN_DATATYPE_NAME };
defaultValues = new Object[] { null, null, true };
if (allowIfExistsTable) {
String sql = queryUtil.createTableIfNotExistsWithDefaults("PLATFORM_PROFILE_FEATURE", colNames, types, defaultValues);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
} else {
if (!queryUtil.tableExists(conn, "PLATFORM_PROFILE_FEATURE", database, schema)) {
String sql = queryUtil.createTable("PLATFORM_PROFILE_FEATURE", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
}
}
{
List<String> allCols = queryUtil.getTableColumns(conn, "PLATFORM_PROFILE_FEATURE", database, schema);
for (int i = 0; i < colNames.length; i++) {
String col = colNames[i];
if (!allCols.contains(col) && !allCols.contains(col.toLowerCase())) {
classLogger.info("Column '{}' is not present in current list of columns: {}", col, allCols);
String addColumnSql = queryUtil.alterTableAddColumn("PLATFORM_PROFILE_FEATURE", col, types[i]);
classLogger.info("Running sql {}", addColumnSql);
securityDb.insertData(addColumnSql);
}
}
}

// PLATFORM_USER_PROFILE — user-to-platform-profile assignment (one per user)
colNames = new String[] { "USER_ID", "PROFILE_ID", "ASSIGNED_BY", "ASSIGNED_AT" };
types = new String[] { "VARCHAR(255)", "VARCHAR(255)", "VARCHAR(255)", TIMESTAMP_DATATYPE_NAME };
if (allowIfExistsTable) {
String sql = queryUtil.createTableIfNotExists("PLATFORM_USER_PROFILE", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
} else {
if (!queryUtil.tableExists(conn, "PLATFORM_USER_PROFILE", database, schema)) {
String sql = queryUtil.createTable("PLATFORM_USER_PROFILE", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
}
}
{
List<String> allCols = queryUtil.getTableColumns(conn, "PLATFORM_USER_PROFILE", database, schema);
for (int i = 0; i < colNames.length; i++) {
String col = colNames[i];
if (!allCols.contains(col) && !allCols.contains(col.toLowerCase())) {
classLogger.info("Column '{}' is not present in current list of columns: {}", col, allCols);
String addColumnSql = queryUtil.alterTableAddColumn("PLATFORM_USER_PROFILE", col, types[i]);
classLogger.info("Running sql {}", addColumnSql);
securityDb.insertData(addColumnSql);
}
}
}

// APP_PROFILE_SUBGROUP — named sub-groups within a group-style profile
colNames = new String[] { "SUBGROUP_ID", "PROFILE_ID", "APP_ID", "SUBGROUP_NAME", "DESCRIPTION", "CREATED_BY", "CREATED_AT" };
types = new String[] { "VARCHAR(255)", "VARCHAR(255)", "VARCHAR(255)", "VARCHAR(255)", "VARCHAR(2000)", "VARCHAR(255)", TIMESTAMP_DATATYPE_NAME };
if (allowIfExistsTable) {
String sql = queryUtil.createTableIfNotExists("APP_PROFILE_SUBGROUP", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
} else {
if (!queryUtil.tableExists(conn, "APP_PROFILE_SUBGROUP", database, schema)) {
String sql = queryUtil.createTable("APP_PROFILE_SUBGROUP", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
}
}
{
List<String> allCols = queryUtil.getTableColumns(conn, "APP_PROFILE_SUBGROUP", database, schema);
for (int i = 0; i < colNames.length; i++) {
String col = colNames[i];
if (!allCols.contains(col) && !allCols.contains(col.toLowerCase())) {
classLogger.info("Column '{}' is not present in current list of columns: {}", col, allCols);
String addColumnSql = queryUtil.alterTableAddColumn("APP_PROFILE_SUBGROUP", col, types[i]);
classLogger.info("Running sql {}", addColumnSql);
securityDb.insertData(addColumnSql);
}
}
}

// APP_SUBGROUP_FEATURE — feature flags per sub-group
colNames = new String[] { "APP_ID", "SUBGROUP_ID", "FEATURE_ID", "ENABLED" };
types = new String[] { "VARCHAR(255)", "VARCHAR(255)", "VARCHAR(255)", BOOLEAN_DATATYPE_NAME };
defaultValues = new Object[] { null, null, null, true };
if (allowIfExistsTable) {
String sql = queryUtil.createTableIfNotExistsWithDefaults("APP_SUBGROUP_FEATURE", colNames, types, defaultValues);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
} else {
if (!queryUtil.tableExists(conn, "APP_SUBGROUP_FEATURE", database, schema)) {
String sql = queryUtil.createTable("APP_SUBGROUP_FEATURE", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
}
}
{
List<String> allCols = queryUtil.getTableColumns(conn, "APP_SUBGROUP_FEATURE", database, schema);
for (int i = 0; i < colNames.length; i++) {
String col = colNames[i];
if (!allCols.contains(col) && !allCols.contains(col.toLowerCase())) {
classLogger.info("Column '{}' is not present in current list of columns: {}", col, allCols);
String addColumnSql = queryUtil.alterTableAddColumn("APP_SUBGROUP_FEATURE", col, types[i]);
classLogger.info("Running sql {}", addColumnSql);
securityDb.insertData(addColumnSql);
}
}
}

// APP_USER_SUBGROUP — user-to-subgroup assignment (many-to-many)
colNames = new String[] { "APP_ID", "USER_ID", "SUBGROUP_ID", "ASSIGNED_BY", "ASSIGNED_AT" };
types = new String[] { "VARCHAR(255)", "VARCHAR(255)", "VARCHAR(255)", "VARCHAR(255)", TIMESTAMP_DATATYPE_NAME };
if (allowIfExistsTable) {
String sql = queryUtil.createTableIfNotExists("APP_USER_SUBGROUP", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
} else {
if (!queryUtil.tableExists(conn, "APP_USER_SUBGROUP", database, schema)) {
String sql = queryUtil.createTable("APP_USER_SUBGROUP", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
}
}
{
List<String> allCols = queryUtil.getTableColumns(conn, "APP_USER_SUBGROUP", database, schema);
for (int i = 0; i < colNames.length; i++) {
String col = colNames[i];
if (!allCols.contains(col) && !allCols.contains(col.toLowerCase())) {
classLogger.info("Column '{}' is not present in current list of columns: {}", col, allCols);
String addColumnSql = queryUtil.alterTableAddColumn("APP_USER_SUBGROUP", col, types[i]);
classLogger.info("Running sql {}", addColumnSql);
securityDb.insertData(addColumnSql);
}
}
}

// APP_PROFILE_MANAGER — delegated assign permission for BU admins
colNames = new String[] { "APP_ID", "USER_ID", "PERMISSION" };
types = new String[] { "VARCHAR(255)", "VARCHAR(255)", "VARCHAR(50)" };
if (allowIfExistsTable) {
String sql = queryUtil.createTableIfNotExists("APP_PROFILE_MANAGER", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
} else {
if (!queryUtil.tableExists(conn, "APP_PROFILE_MANAGER", database, schema)) {
String sql = queryUtil.createTable("APP_PROFILE_MANAGER", colNames, types);
classLogger.info("Running sql {}", sql);
securityDb.insertData(sql);
}
}
{
List<String> allCols = queryUtil.getTableColumns(conn, "APP_PROFILE_MANAGER", database, schema);
for (int i = 0; i < colNames.length; i++) {
String col = colNames[i];
if (!allCols.contains(col) && !allCols.contains(col.toLowerCase())) {
classLogger.info("Column '{}' is not present in current list of columns: {}", col, allCols);
String addColumnSql = queryUtil.alterTableAddColumn("APP_PROFILE_MANAGER", col, types[i]);
classLogger.info("Running sql {}", addColumnSql);
securityDb.insertData(addColumnSql);
}
}
}

if (!conn.getAutoCommit()) {
conn.commit();
}
Expand Down
Loading
Loading