Skip to content

Add per-user discoverable-to-agents preference for projects and engines - #3276

Draft
ckelly17 wants to merge 1 commit into
devfrom
add-user-discoverable-preference
Draft

ckelly17 wants to merge 1 commit into
devfrom
add-user-discoverable-preference

Conversation

@ckelly17

@ckelly17 ckelly17 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds a per-user USERDISCOVERABLE preference to projects and engines, so each user can choose which of the projects and engines they can see are discoverable to their agents. An example is a skill shared with a user that they only want to use in certain situations.

The flag works the same way as favorite and visibility: it is the user's own setting, stored in USERPROJECTPREFERENCE / USERENGINEPREFERENCE apart from permissions, and saved for each of the user's logins (id and login type). It is off by default: a missing row or a NULL reads as off until the user turns it on.

This PR only stores and returns the flag. Nothing filters what agents see by it yet; that comes when agents start reading it.

Changes Made

  • Schema: new USERDISCOVERABLE boolean column, default false, on USERPROJECTPREFERENCE and USERENGINEPREFERENCE (AbstractSecurityUtils). Existing installs add the column on startup; existing rows read as off.
  • OWL: column added to both tables in SecurityOwlCreator. A missing column makes needsRemake rebuild the OWL on existing installs.
  • Setters: SecurityProjectUtils.setProjectUserDiscoverable and SecurityEngineUtils.setEngineUserDiscoverable, built on setUserPreference. Same access rule as favorite: allowed when the item is public or the user can view it, so read-only users of a shared item can set it. Setting it adds no permission row.
  • Read side: the user preference join selects MAX(CAST(USERDISCOVERABLE)). getUserProjectList (both variants) returns project_user_discoverable and getUserEngineList returns engine_user_discoverable, as 0 or 1. MyProjects and MyEngines return the field through these methods, and their output schemas now list it.
  • Reactors: SetProjectUserDiscoverable(project=, discoverable=) and SetEngineUserDiscoverable(engine=, discoverable=) in prerna.reactor.security, picked up by the classpath scan. discoverable is required and must be true or false.
  • Tests: new unit tests in SecurityProjectUtilsUnitTests and SecurityEngineUtilsUnitTests.

How to Test

  1. Run SecurityProjectUtilsUnitTests and SecurityEngineUtilsUnitTests. The new *UserDiscoverable* tests cover: no access is refused, the flag is off until turned on, turning it on and off changes only that item and keeps the favorite, and a public item can be set by a user with no direct access without adding a permission row or affecting other users.
  2. On a running instance, call MyProjects() / MyEngines(). Every row should have project_user_discoverable / engine_user_discoverable set to 0.
  3. Run SetProjectUserDiscoverable(project=["<id>"], discoverable=[true]) (or SetEngineUserDiscoverable(engine=["<id>"], discoverable=[true])), then call MyProjects() / MyEngines() again: that item shows 1 for this user only. Setting it back to false returns it to 0.

Add a USERDISCOVERABLE boolean to USERPROJECTPREFERENCE and
USERENGINEPREFERENCE so each user can mark which projects and engines
their agents may find and use. It is off until the user turns it on; a
missing row or null reads as off.

- Schema and OWL: new column, default false, added on startup
- setProjectUserDiscoverable / setEngineUserDiscoverable save it for
  each of the user's logins, for anyone who can view the item
- getUserProjectList / getUserEngineList return
  project_user_discoverable / engine_user_discoverable (0 or 1), so
  MyProjects and MyEngines include it; their output schemas list it
- New reactors SetProjectUserDiscoverable and SetEngineUserDiscoverable
- Unit tests for both
@ckelly17
ckelly17 requested a review from a team as a code owner November 5, 2026 21:51
@snyk-io

snyk-io Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@ckelly17
ckelly17 marked this pull request as draft November 5, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant