Waldons IT & Security Operations

Real-time Store Monitoring Dashboard 🌸

Sunday 6 September 2026

19:05:20

User Functions & Management

Understanding user roles, permissions, and access control in POSight

User Entity Structure

How user data is stored and organized

Built-in User Fields (automatic):

  • id - Unique identifier
  • email - Login email
  • full_name - Display name
  • role - 'admin' or 'user'
  • created_date - When user was added

POSight Custom Fields:

  • access_level - System permissions
  • assigned_stores - Store IDs array
  • region - Geographic area
  • store_role - Job function
Access Levels & Permissions

User groups and what they can access

system_admin
Support Desk Manager
  • • View all 720 stores
  • • Access all settings & user management
  • • Full AI chat capabilities
operations_admin
Franchisee Support Desk
  • • View all 720 stores
  • • Manage incidents across the network
  • • Generate reports for any store
  • • AI access to all store data
store_manager
Store Owner / Manager
  • • View only their assigned store(s)
  • • Store-specific performance data
  • • AI limited to their store only
Common User Functions in Code

How to work with users in your backend scripts

Getting Current User Information

// Get the currently logged-in user
const user = await User.me();

console.log(user.full_name);        // "John Smith"
console.log(user.access_level);     // "store_manager"
console.log(user.assigned_stores);  // ["store_123", "store_456"]
console.log(user.region);          // "Munster"

Checking User Permissions

// Check if user can access a specific store
function canAccessStore(user, storeId) {
  // System admins can access everything
  if (user.access_level === 'system_admin') {
    return true;
  }
  
  // Check if store is in their assigned stores
  return user.assigned_stores && user.assigned_stores.includes(storeId);
}

// Usage
const hasAccess = canAccessStore(user, "store_123");

Creating New Users

// Create a new store manager
const newUser = await User.create({
  email: "manager@supervalu-cork.ie",
  full_name: "Mary O'Connor", 
  access_level: "store_manager",
  assigned_stores: ["store_cork_01"],
  region: "Munster",
  store_role: "manager"
});

Updating User Permissions

// Give a user access to additional stores
const userId = "user_123";
const currentUser = await User.get(userId);

const updatedStores = [...currentUser.assigned_stores, "store_456"];

await User.update(userId, {
  assigned_stores: updatedStores,
  access_level: "operations_admin"  // Promote them
});

Filtering Data by User Access

// Get stores that a user can access
async function getAccessibleStores(user) {
  // System and Operations admins can see all stores
  if (user.access_level === 'system_admin' || user.access_level === 'operations_admin') {
    return await Store.list();
  }
  
  // Store manager
  return await Store.filter({ id__in: user.assigned_stores });
}
User Management Interface

How the UserManagement page works

Current Features:

  • View All Users: Lists all users with their current access levels and assigned stores
  • Edit Permissions: Modify user access levels and store assignments
  • Store Assignment: Checkbox interface to assign/unassign stores to users
  • Role-Based Access: Only system_admin and operations_admin can access this page

Important Note about User Creation

New users must be invited manually through the base44 platform (Dashboard → Users). You cannot create users through the app itself - only modify permissions of existing users.

User Security in AI Chat

How the POSight AI respects user permissions

The POSight Intelligence Agent automatically respects user access levels when providing information:

Store Manager asks:

"How is my store doing today?"

✅ AI shows data only for their assigned store(s)

Regional Manager asks:

"Show me all stores in Munster"

✅ AI shows all stores in their region

If someone tries to access unauthorized data:

"I can only provide information about your assigned stores: [Store Name]. For access to other locations, please contact your supervisor or the operations team."