# User Profile Comparison

> Compares profile attributes, aliases, assigned roles, effective permission lists, authorizations, emails, favorites, and special-use bindings across two PeopleSoft user profiles.

---

Site [llms.txt](/llms.txt)

---

<div class="alert alert-primary border shadow-sm mb-4 psl-prospect-cta" role="note">
  <div class="d-flex flex-column flex-lg-row align-items-lg-center justify-content-between gap-3">
    <div>
      <strong>New to psLens?</strong> This page documents one specific report. To see how it runs in the product, what
      the output looks like, and how teams use it in practice, start with a live walkthrough.
    </div>
    <div class="d-flex flex-wrap gap-2">
      <a class="btn btn-sm btn-primary" href="/contact/">Book a Demo</a>
      <a class="btn btn-sm btn-outline-primary" href="/docs/reports/">Browse Reports</a>
    </div>
  </div>
</div><div id="pslens-context-panel" class="card border-info mb-4 d-none">
  <div class="card-header bg-light text-info py-2 fw-bold d-flex align-items-center border-bottom border-info-subtle">
    <i class="bi bi-info-circle-fill me-2"></i>
    <span>Tailored Operational Context</span>
  </div>
  <div class="card-body p-0">
    <ul class="list-group list-group-flush">
      <li id="row-db" class="list-group-item d-flex align-items-center justify-content-between py-2 d-none">
        <strong>Target Database:</strong>
        <span id="ctx-db" class="badge bg-secondary font-monospace">&mdash;</span>
      </li>
      <li id="row-type" class="list-group-item d-flex align-items-center justify-content-between py-2 d-none">
        <strong>Context Type:</strong>
        <span id="ctx-type" class="badge bg-light text-dark border font-monospace text-uppercase">&mdash;</span>
      </li>
      <li id="row-severity" class="list-group-item d-flex align-items-center justify-content-between py-2 d-none">
        <strong id="label-severity">Alert Severity:</strong>
        <span id="ctx-severity" class="badge">&mdash;</span>
      </li>
      <li id="row-time" class="list-group-item d-flex align-items-center justify-content-between py-2 d-none">
        <strong>Triggered Time:</strong>
        <span id="ctx-time" class="text-muted small">&mdash;</span>
      </li>
      <li id="row-details" class="list-group-item py-2 d-none">
        <strong id="label-details" class="d-block mb-1">Firing Context:</strong>
        <code id="ctx-details" class="d-block p-2 bg-light border rounded small"
          style="white-space: pre-wrap; word-break: break-all;">&mdash;</code>
      </li>
      <li id="row-sql" class="list-group-item py-2 d-none">
        <div class="d-flex justify-content-between align-items-center mb-1">
          <strong id="label-sql">Contextual SQL:</strong>
          <button id="btn-copy-sql" type="button" class="btn btn-sm btn-outline-secondary py-0 px-2 small">
            <i class="bi bi-clipboard me-1"></i>Copy SQL
          </button>
        </div>
        <pre class="mb-0 p-2 bg-light border rounded small"><code id="ctx-sql" style="white-space: pre-wrap; word-break: break-word;">&mdash;</code></pre>
      </li>
    </ul>
  </div>
</div>

<script>
  (function () {
    const params = new URLSearchParams(window.location.search);
    const metadata = params.get('metadata');
    if (!metadata) return;

    try {
      
      const base64 = metadata.replace(/-/g, '+').replace(/_/g, '/');
      const jsonStr = decodeURIComponent(escape(window.atob(base64)));
      const data = JSON.parse(jsonStr);

      if (data) {
        let hasData = false;

        if (data.db) {
          document.getElementById('ctx-db').textContent = data.db;
          document.getElementById('row-db').classList.remove('d-none');
          hasData = true;
        }

        if (data.type) {
          document.getElementById('ctx-type').textContent = data.type;
          document.getElementById('row-type').classList.remove('d-none');
          if (data.type === 'health') {
            document.getElementById('label-severity').textContent = 'Health Status:';
          }
          hasData = true;
        }

        if (data.severity) {
          const severityBadge = document.getElementById('ctx-severity');
          const severity = data.severity.toLowerCase();
          severityBadge.textContent = severity.toUpperCase();
          if (severity === 'critical') {
            severityBadge.className = 'badge bg-danger';
          } else if (severity === 'warning' || severity === 'degraded') {
            severityBadge.className = 'badge bg-warning text-dark';
          } else if (severity === 'healthy') {
            severityBadge.className = 'badge bg-success';
          } else if (severity === 'disabled') {
            severityBadge.className = 'badge bg-secondary';
          } else {
            severityBadge.className = 'badge bg-info';
          }
          document.getElementById('row-severity').classList.remove('d-none');
          hasData = true;
        }

        if (data.t) {
          const date = new Date(data.t * 1000);
          document.getElementById('ctx-time').textContent = date.toLocaleString();
          document.getElementById('row-time').classList.remove('d-none');
          hasData = true;
        }

        if (data.details) {
          document.getElementById('ctx-details').textContent = data.details;

          
          const labelDetails = document.getElementById('label-details');
          if (data.type === 'object') {
            labelDetails.textContent = 'Object Metadata Details:';
          } else if (data.type === 'report') {
            labelDetails.textContent = 'Report Description:';
          } else if (data.type === 'health') {
            labelDetails.textContent = 'Gauge Breakdown:';
          } else {
            labelDetails.textContent = 'Firing Context:';
          }

          document.getElementById('row-details').classList.remove('d-none');
          hasData = true;
        }

        if (data.sql) {
          document.getElementById('ctx-sql').textContent = data.sql;
          document.getElementById('row-sql').classList.remove('d-none');
          const copyBtn = document.getElementById('btn-copy-sql');
          if (copyBtn && navigator.clipboard) {
            copyBtn.addEventListener('click', function () {
              navigator.clipboard.writeText(data.sql).then(function () {
                copyBtn.innerHTML = '<i class="bi bi-check2 me-1"></i>Copied';
                setTimeout(function () {
                  copyBtn.innerHTML = '<i class="bi bi-clipboard me-1"></i>Copy SQL';
                }, 2000);
              });
            });
          }
          hasData = true;
        }

        if (hasData) {
          document.getElementById('pslens-context-panel').classList.remove('d-none');
        }
      }
    } catch (e) {
      console.error('Failed to parse operational context metadata:', e);
    }
  })();
</script>

## User Profile Comparison Report

**Report ID:** `security-compare-users`
**Category:** Security

User Profile Comparison diffs two PeopleSoft user accounts (`PSOPRDEFN`) across databases or within the same database across profile attributes, aliases, assigned roles, effective authorizations, email addresses, portal favorites, and system service bindings.

## Parameters

| Parameter   | Required | Default          | Description                                                        |
| ----------- | -------- | ---------------- | ------------------------------------------------------------------ |
| `operID1`   | Yes      | —                | Source User ID (`OPRID`), trimmed and converted to uppercase.      |
| `target_db` | No       | Source database  | Target database name configured in psLens.                         |
| `operID2`   | No       | Same as `operID1` | Target User ID (`OPRID`), trimmed and converted to uppercase.     |

Comparing the same User ID in the same database returns an error. Before expanding roles and permissions, psLens checks `PSOPRDEFN` in both databases and stops with an error if either user profile does not exist.

## Tables Queried

| Table           | Purpose                                                                      |
| --------------- | ---------------------------------------------------------------------------- |
| `PSOPRDEFN`     | Core user profile attributes, lock status, primary/row-security/process-profile permission lists, and existence check (credential columns excluded) |
| `PSOPRALIAS`    | User ID alias mappings (Employee, Contact, Customer, Vendor, and related IDs) |
| `PSROLEUSER`    | Directly assigned roles and `DYNAMIC_SW` flags                               |
| `PSROLEDEFN`    | Subquery filter ensuring only defined roles are expanded                     |
| `PSROLECLASS`   | Mapping from assigned roles to effective permission lists                    |
| `PSCLASSDEFN`   | Subquery filter ensuring only defined permission lists are expanded          |
| `PSAUTHITEM`    | Effective component/page and `WEBLIB_%` authorizations across all effective permission lists |
| `PSMENUITEM`    | Menu and component enrichment joined with `PSAUTHITEM`                       |
| `PSAUTHBUSCOMP` | Effective component interface authorizations                                 |
| `PSAUTHWS`      | Authorized Integration Broker service operations via assigned roles          |
| `PSAUTHPRCS`    | Effective process group authorizations                                       |
| `SCRTY_ACC_GRP` | Effective accessible query trees and access groups (`ACCESSIBLE = 'Y'`)      |
| `PSUSEREMAIL`   | User email entries and `PRIMARY_EMAIL` indicator                             |
| `PSPRUFDEFN`    | Saved portal favorites                                                       |
| `PSMSGNODEDEFN` | Inbound default node user bindings (`USERID`, credential columns excluded)   |
| `PSOPTIONS`     | System-wide Signon PeopleCode default user (`OPRID`)                        |

Effective permission lists combine every `CLASSID` granted by `PSROLECLASS` with the user's `OPRCLASS` (Primary Permission List), `ROWSECCLASS` (Row Security Permission List), and `PRCSPRFLCLS` (Process Profile Permission List) from `PSOPRDEFN`.

If any secondary table is not whitelisted in SWS in either database, the report completes with a **Partial Data Notice** warning listing the unwhitelisted table and database.

## Report Output

The generated Markdown document includes these sections when populated:

- **Header Link**: Direct link back to `/users/compare` in psLens with both databases and User IDs preselected.
- **Summary**: Counts for Total Compared Items, Identical / Matching, Differences, Only in Source, and Only in Target, plus any Partial Data Notice.
- **Account & Profile Attributes**: Side-by-side comparison of 14 `PSOPRDEFN` attributes (Description, Employee ID, Primary Email, Account Status, Operator Type, Language Code, Currency Code, Symbolic ID, Primary Permission List, Row Security Permission List, Process Profile, Default Nav Homepage, Password Set, and Failed Logins).
- **User ID Aliases**: Alias types and values from `PSOPRALIAS`.
- **Assigned Roles**: Role names and `DYNAMIC_SW` flags from `PSROLEUSER`.
- **Effective Permission Lists**: Effective `CLASSID` list with the granting role sources.
- **Effective Components & Pages**: Component, menu, page/item, actions, and display-only status.
- **Effective Web Libraries**: `WEBLIB_%` functions and authorized action masks.
- **Effective Component Interfaces**: Component interface and method authorizations.
- **Authorized Service Operations**: Service operation names and authorized action masks.
- **Effective Process Groups**: Process groups accessible through the user's permission lists.
- **Effective Query Trees & Access Groups**: Accessible query trees and access groups.
- **User Emails**: Email types, addresses, and primary indicator from `PSUSEREMAIL`.
- **Portal Favorites**: Object names and labels from `PSPRUFDEFN`.
- **Special System Usage & Bindings**: Whether the account is the Signon PeopleCode default in `PSOPTIONS` or the default inbound user on any `PSMSGNODEDEFN` node.

## How to Run

- **From Reports**: Open **Reports > Run Report** and select **User Profile Comparison** under **Security Audits**. Choose the source database, enter `operID1` (plus optional `target_db` and `operID2`), and click **Run Now** or **Schedule**.
- **From Compare Users**: Open **Security > Compare Users** (`/users/compare`) to compare interactively and save the run to Report History. See [Users](/docs/security/users/).
