# Employee Master, My Profile & Access Control - Test Guide

## Upgrade

Run after deploying these files:

```bash
flask db upgrade
python scripts/seed.py
```

The migration adds `menu_items` and `role_menu_items`. The seed adds the new permissions, default navigation and basic employee masters.

## 1. Employee Master

Login as the development Admin and open **Admin -> Employee Master**.

Test:
- Search by name, employee ID or email.
- Filter by role and active/inactive status.
- Create an employee.
- Map Department, Designation, Business Unit, City, Location and Reporting Manager.
- Assign one or more roles.
- Mark portal eligibility and active/inactive status.
- Edit an employee and confirm the user email/access status is kept in sync.

## 2. My Profile

Login as Employee or Manager and open **My Profile**.

HR/SSO-controlled fields are read-only:
- Employee ID
- Full name
- Official email
- Department
- Designation
- Business Unit
- Location
- Reporting Manager

Employee-editable fields:
- Mobile number
- Preferred city
- Cause preferences
- Accessibility/support preferences

## 3. Role-wise menu management

Login as Admin and open **Admin -> Access Control**.

Open a role and change its menu assignments. Logout/login as a user with that role and confirm only the assigned menus appear.

Public navigation (Home, Seva Bhaav and Seva Daan) is not controlled by role menus because it remains publicly accessible.

## 4. Functional permissions

The same Access Control page manages functional permissions. Menu visibility and server-side permission are separate:

- A menu can be hidden while a role still has the underlying permission.
- A menu can be visible but the protected page/action will return 403 if the role lacks its required permission.
- SUPER_ADMIN always has functional permission bypass, but its visible menu can still be customized.

## 5. Suggested role checks

### EMPLOYEE
Expected: Employee Home, My Profile, My Seva, My Impact, Notifications.

### MANAGER
Expected: employee menus plus Manager -> Approvals.

### SUPER_ADMIN / PIRAMAL_ADMIN / INDIAISUS_ADMIN
Expected: employee menus, Manager area, and complete Admin dropdown including Employee Master and Access Control.

## Deployment note

Do not run `flask db migrate` on live for this release because a migration file is already included. Run only:

```bash
flask db upgrade
python scripts/seed.py
```
