Skip to content

Larsszz/ps-comparator

Repository files navigation

Permission Set Comparator

Powerful side-by-side comparison tool for Salesforce Permission Sets

Salesforce API License Status

Permission Set Comparator is a Lightning Web Component-based application that enables Salesforce administrators to compare permission sets side-by-side, identify differences, and manage security configurations with confidence.


Table of Contents


Features

Current Features (v1.0 MVP)

Core Comparison Capabilities

  • Side-by-Side Comparison: Compare two permission sets in a clean, intuitive interface
  • Comprehensive Permission Analysis: Compare across all permission types:
    • Object Permissions (Create, Read, Update, Delete, View All, Modify All)
    • Field-Level Security (Read, Edit permissions)
    • System Permissions (API Enabled, View All Data, Modify All Data, etc.)
    • Apex Class Access
    • Visualforce Page Access
    • Tab Settings
  • Visual Difference Indicators: Color-coded highlighting shows added, removed, and changed permissions
  • Smart Search: Quickly find permission sets with searchable selectors
  • Summary Statistics: At-a-glance view of total differences by category
  • Flexible Viewing: Toggle between tabbed and accordion views
  • Quick Swap: Instantly swap which permission set is on the left vs. right

Planned Features

See Roadmap for detailed feature planning including:

  • Multi-permission set comparison (v1.1)
  • Export to CSV/Excel/PDF (v1.1)
  • Bulk permission modifications (v1.2)
  • AI-powered permission suggestions (v2.0)
  • Multi-org comparison (v2.1)

Installation

Prerequisites

  • Salesforce org (Production, Developer, or Sandbox)
  • System Administrator or equivalent permissions
  • API access enabled

Option 1: Install Managed Package (Recommended)

You can install the application directly into your Salesforce environment (Sandbox recommended for testing) using the link below:

*Install Permission Set Comparator (v0.1.0) **

  1. Log in to your Salesforce org.
  2. Click the link above.
  3. Select "Install for All Users".
  4. Click "Install".

Option 2: Deploy from Source (For Developers)

  1. Clone the repository:

    git clone https://github.com/your-org/ps-comparator.git
    cd ps-comparator
  2. Authenticate to your org:

    sf org login web -a YourOrgAlias
  3. Deploy the source:

    sf project deploy start -o YourOrgAlias
  4. Assign the Permission Set:

    sf org assign permset -n PSC_Admin -o YourOrgAlias

Quick Start

Accessing the App

  1. Navigate to the App Launcher in Salesforce
  2. Search for "Permission Set Comparator"
  3. Click to open the application

Running Your First Comparison

  1. Select Permission Sets:

    • Use the left dropdown to select your first permission set
    • Use the right dropdown to select a second permission set
  2. Click "Compare":

    • The system will analyze both permission sets
    • Results appear in seconds
  3. Review Differences:

    • Browse through tabs: Objects, Fields, System, Apex, VF Pages, Tabs
    • Numbers in parentheses show difference counts per category
    • Color coding:
      • Green: Permission added in PS2
      • Red: Permission removed in PS2
      • Yellow: Permission exists but differs between sets
  4. Use Quick Actions:

    • Swap: Switch which permission set is on left/right
    • Reset: Clear selections and start over

Usage Guide

Understanding the Interface

Header Section

  • Permission Set 1 (Left): Select the baseline permission set
  • Permission Set 2 (Right): Select the permission set to compare against
  • Swap Button: Reverse the two permission sets
  • Compare Button: Execute the comparison
  • Reset Button: Clear all selections and results

Results Section

Summary Card displays:

  • Total number of differences found
  • Breakdown by permission type
  • Comparison timestamp

Comparison Tabs:

  • Objects: CRUD and View/Modify All permissions for standard and custom objects
  • Fields: Field-level security for all fields across objects
  • System: Administrative and system-level permissions
  • Apex: Apex class access permissions
  • VF Pages: Visualforce page access permissions
  • Tabs: Tab visibility settings

Interpreting Results

Each permission difference shows:

  • Permission Name: The specific permission being compared
  • Value in PS1: Enabled (✓) or Disabled (✗) in the first permission set
  • Value in PS2: Enabled (✓) or Disabled (✗) in the second permission set
  • Difference Type:
    • ADDED: Permission is enabled in PS2 but not in PS1
    • REMOVED: Permission is enabled in PS1 but not in PS2
    • SAME: Permission has identical values in both sets

Best Practices

  1. Start with Object Permissions: Review object-level access before diving into fields
  2. Check System Permissions: These often have the highest security impact
  3. Document Your Findings: Take screenshots or notes of important differences
  4. Compare Regularly: Run comparisons when creating new permission sets or troubleshooting access issues
  5. Use Meaningful Names: Ensure permission sets have clear, descriptive labels

Common Use Cases

Creating a New Permission Set

Compare your new permission set against a similar existing one to ensure you haven't missed permissions.

Troubleshooting Access Issues

Compare a working user's permission set against a non-working user's to identify missing permissions.

Security Audits

Compare permission sets before and after changes to track security modifications.

Permission Set Consolidation

Identify overlapping permissions when combining or streamlining permission sets.

Training & Documentation

Use comparisons to document permission requirements for different roles.


Screenshots

Screenshots will be added here showing:

  • Main comparison interface
  • Permission selection dropdowns
  • Detailed difference view
  • Summary statistics panel
  • Different permission categories (Objects, Fields, System, etc.)

Technical Architecture

Technology Stack

  • Platform: Salesforce Lightning Experience
  • Frontend: Lightning Web Components (LWC)
  • Backend: Apex (API Version 65.0)
  • Package Type: 2GP (Second-Generation Managed Package)
  • Namespace: sspc

Component Architecture

Apex Classes

Class Purpose
PSC_ComparisonController AuraEnabled controller exposing methods to LWC
PSC_PermissionSetService Business logic for permission set comparisons
PSC_PermissionSetSelector SOQL queries for permission data retrieval
PSC_ComparisonResult Wrapper class for comparison results
PSC_PermissionDiff Represents individual permission differences
PSC_ComparisonException Custom exception handling
PSC_TestDataFactory Test data factory for unit tests

Lightning Web Components

Component Purpose
permissionSetComparator Main container component
permissionSetSelector Searchable permission set picker
comparisonSummary Statistics and summary display
comparisonTable Generic table for permission differences
groupedFieldTable Specialized table for field permissions by object
diffIndicator Visual indicator for difference types

Data Model

The application uses standard Salesforce objects:

  • PermissionSet
  • ObjectPermissions
  • FieldPermissions
  • SetupEntityAccess
  • PermissionSetTabSetting
  • ApexClass
  • ApexPage

Security Model

  • All Apex classes use with sharing for row-level security
  • CRUD/FLS enforced via standard platform security
  • No hardcoded credentials or IDs
  • AppExchange security review compliant

Development

Setting Up Your Development Environment

Prerequisites

  • Salesforce CLI (sf)
  • Node.js 18+ (for LWC development)
  • VS Code with Salesforce Extension Pack
  • Git
  • Dev Hub enabled org

Initial Setup

# Clone repository
git clone https://github.com/your-org/ps-comparator.git
cd ps-comparator

# Install Node dependencies
npm install

# Authenticate Dev Hub
sf org login web -d -a DevHub

# Create scratch org
sf org create scratch -f config/project-scratch-def.json -a PSC_Dev -d 30

# Push source to scratch org
sf project deploy start -o PSC_Dev

# Assign permission set
sf org assign permset -n PSC_Admin -o PSC_Dev

# Open org
sf org open -o PSC_Dev

Running Tests

Apex Tests

# Run all tests with coverage
sf apex run test --code-coverage --result-format human -o PSC_Dev

# Run specific test class
sf apex run test --class-names PSC_PermissionSetServiceTest -o PSC_Dev

LWC Tests (Jest)

# Run all Jest tests
npm run test:unit

# Run tests in watch mode
npm run test:unit:watch

# Run tests with coverage
npm run test:unit:coverage

Code Quality

# Run ESLint
npm run lint

# Auto-fix ESLint issues
npm run lint:fix

Coding Standards

This project follows strict coding standards. Key guidelines include:

  • Apex: ApexDoc comments, max 40 lines per method, 90%+ test coverage
  • LWC: Component-focused architecture, Jest tests for all components
  • Naming: PSC_ prefix for all Apex classes, psc prefix for CSS
  • Security: AppExchange security review compliance mandatory

Contributing

We welcome contributions! Here's how you can help:

Reporting Issues

  • Use GitHub Issues to report bugs
  • Include steps to reproduce
  • Provide Salesforce org edition and API version
  • Include error messages and screenshots

Pull Request Process

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Follow coding standards (see Coding Standards section)
  4. Write tests (maintain 90%+ coverage)
  5. Commit changes (git commit -m 'Add AmazingFeature')
  6. Push to branch (git push origin feature/AmazingFeature)
  7. Open a Pull Request

Code Review Criteria

  • All tests passing
  • Code coverage above 90%
  • Follows established patterns and standards
  • Security best practices followed
  • ApexDoc/JSDoc comments present
  • No hardcoded IDs or credentials

Roadmap

See permission-set-comparator-roadmap.md for the complete product roadmap.

Upcoming Releases

  • v1.1 (Precision): Multi-permission set comparison, export to CSV/Excel/PDF
  • v1.2 (Action): Bulk permission modifications, permission set creation
  • v2.0 (Intelligence): AI-powered permission suggestions and security scoring
  • v2.1 (Enterprise): Multi-org comparison, team collaboration features

Feedback & Support

We are actively developing this tool and we need your feedback!

Our goal is to build the best permission management tool for Salesforce Admins and Developers. We are committed to supporting and improving this application based on your input.

How to Contribute Feedback

  • Feature Requests: Have an idea? Open an Issue with the " enhancement" label.
  • Bug Reports: Found something broken? Report a Bug so we can fix it.
  • General Questions: Start a discussion in our GitHub Discussions tab.

Getting Help

  • Documentation: See this README for technical details.

License

This project is commercial software intended for distribution on the Salesforce AppExchange.

Copyright © 2025 [Your Company Name]

For licensing inquiries, contact: licensing@yourcompany.com


Acknowledgments

  • Built with Salesforce Lightning Web Components
  • Follows Salesforce UX/UI best practices using SLDS
  • Inspired by the need for better permission management in Salesforce

Project Information

  • Product Name: Permission Set Comparator
  • Version: 1.0.0 (MVP)
  • Namespace: sspc
  • Salesforce API: v65.0
  • Status: In Development
  • Target Platform: Salesforce Lightning Experience

Quick Links


Last Updated: January 2025

About

Permission Set comparation tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published