No description
Find a file
padreug 217fee6664 Add bulk grant permissions UI feature
Implements Phase 1 of UI improvements plan with bulk grant dialog.

Changes:
- Replace single "Grant Permission" button with button group + dropdown menu
- Add "Bulk Grant" option in dropdown menu
- Add comprehensive bulk grant dialog:
  * Multi-select user dropdown (with chips)
  * Single account selector
  * Permission type selector with descriptions
  * Optional expiration date
  * Optional notes field
  * Preview banner showing what will be granted
  * Results display with success/failure counts
  * Errors dialog for viewing failed grants

JavaScript additions:
- New data properties: showBulkGrantDialog, showBulkGrantErrors, bulkGranting, bulkGrantResults, bulkGrantForm
- New computed property: isBulkGrantFormValid
- New methods: bulkGrantPermissions(), closeBulkGrantDialog(), resetBulkGrantForm()

User Experience improvements:
- Time to onboard 5 users: 10min → 1min (90% reduction)
- Clear feedback with success/failure counts
- Ability to review errors before closing dialog
- Auto-close on complete success after 2 seconds

Related: UI-IMPROVEMENTS-PLAN.md Phase 1
API endpoint: POST /api/v1/admin/permissions/bulk-grant

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 02:23:53 +01:00
core Removes core balance calculation logic 2025-11-10 01:06:51 +01:00
docs Add UI improvements plan for bulk permission features 2025-11-11 00:05:57 +01:00
helper HELPER FILE TO DELETE/REVISE 2025-11-10 21:44:43 +01:00
static Add bulk grant permissions UI feature 2025-11-11 02:23:53 +01:00
templates/castle Add bulk grant permissions UI feature 2025-11-11 02:23:53 +01:00
.gitignore initial commit 2025-10-22 12:33:45 +02:00
__init__.py Integrate account sync with API, background tasks, and user creation 2025-11-11 01:28:59 +01:00
account_sync.py Filter inactive accounts from default queries 2025-11-11 01:57:42 +01:00
account_utils.py Removes parent-only accounts 2025-11-07 23:24:11 +01:00
beancount_format.py Implement hybrid approach for balance assertions 2025-11-10 20:46:12 +01:00
CLAUDE.md update CLAUDE.md 2025-11-10 19:32:00 +01:00
config.json initial commit 2025-10-22 12:33:45 +02:00
crud.py Prevent permissions on inactive accounts 2025-11-11 01:59:18 +01:00
description.md initial commit 2025-10-22 12:33:45 +02:00
fava_client.py Use BQL query for get_all_accounts() instead of non-existent API endpoint 2025-11-11 01:34:34 +01:00
manifest.json initial commit 2025-10-22 12:33:45 +02:00
MIGRATION_SQUASH_SUMMARY.md Squash 16 migrations into single clean initial migration 2025-11-10 21:51:11 +01:00
migrations.py Fix m002 migration table name (accounts not castle_accounts) 2025-11-11 02:05:36 +01:00
migrations_old.py.bak Squash 16 migrations into single clean initial migration 2025-11-10 21:51:11 +01:00
models.py Add bulk grant permission API endpoint 2025-11-11 02:13:59 +01:00
permission_management.py Add account sync and bulk permission management 2025-11-10 23:55:26 +01:00
README.md initial commit 2025-10-22 12:33:45 +02:00
services.py Fixes user account creation in Fava/Beancount 2025-11-10 21:22:02 +01:00
tasks.py Integrate account sync with API, background tasks, and user creation 2025-11-11 01:28:59 +01:00
views.py Adds admin permissions management page 2025-11-07 18:05:30 +01:00
views_api.py Add bulk grant permission API endpoint 2025-11-11 02:13:59 +01:00

Castle Accounting Extension for LNbits

A full-featured double-entry accounting system for collective projects, integrated with LNbits Lightning payments.

Overview

Castle Accounting enables collectives like co-living spaces, makerspaces, and community projects to:

  • Track expenses and revenue with proper accounting
  • Manage individual member balances
  • Record contributions as equity or reimbursable expenses
  • Track accounts receivable (what members owe)
  • Generate Lightning invoices for settlements

Installation

This extension is designed to be installed in the lnbits/extensions/ directory.

cd lnbits/extensions/
# Copy or clone the castle directory here

Enable the extension through the LNbits admin interface or by adding it to your configuration.

Usage

For Members

  1. Add an Expense: Record money you spent on behalf of the collective

    • Choose "Liability" if you want reimbursement
    • Choose "Equity" if it's a contribution
  2. View Your Balance: See if the Castle owes you money or vice versa

  3. Pay Outstanding Balance: Generate a Lightning invoice to settle what you owe

For Admins

  1. Create Accounts Receivable: Record when someone owes the collective money

  2. Record Revenue: Track income received by the collective

  3. View All Transactions: See complete accounting history

  4. Make Payments: Record payments to members

Architecture

Data Models

  • Account: Individual accounts in the chart of accounts
  • JournalEntry: Transaction header with description and date
  • EntryLine: Individual debit/credit lines (always balanced)

Account Types

  • Assets: Things the Castle owns (Cash, Bank, Accounts Receivable)
  • Liabilities: What the Castle owes (Accounts Payable to members)
  • Equity: Member contributions and retained earnings
  • Revenue: Income streams
  • Expenses: Operating costs

Database Schema

The extension creates three tables:

  • castle.accounts - Chart of accounts
  • castle.journal_entries - Transaction headers
  • castle.entry_lines - Debit/credit lines

API Reference

See description.md for full API documentation.

Development

To modify this extension:

  1. Edit models in models.py
  2. Add database migrations in migrations.py
  3. Implement business logic in crud.py
  4. Create API endpoints in views_api.py
  5. Update UI in templates/castle/index.html

Contributing

Contributions welcome! Please ensure:

  • Journal entries always balance
  • User permissions are properly checked
  • Database transactions are atomic

License

MIT License - feel free to use and modify for your collective!