feat: implement user authentication and permission-based data filtering
Add user login system with role-based access control: - Admin users see all data and can filter by any manager - Regular users only see records where ManagerName matches their username New components: - BIPUsersDAO: user authentication and management - SessionManager: singleton session state management - LoginDialog: modal login UI for app startup - init_users.sql: initial user setup script Permission enforcement: - Material validation tab: hide manager filter for non-admin, force filter by current user - Material type management: hide filter UI for non-admin, filter at database level - Window title and status bar display current user info Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
23
init_users.sql
Normal file
23
init_users.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
-- =============================================
|
||||
-- Initial User Setup for [dbo].[BIPUsers] Table
|
||||
-- =============================================
|
||||
-- This script creates initial users for the ERP Automation Tool
|
||||
--
|
||||
-- IMPORTANT: Change these passwords before deploying to production!
|
||||
-- =============================================
|
||||
|
||||
-- Create admin user (can see all data)
|
||||
INSERT INTO [dbo].[BIPUsers] (UserName, Password, UserType) VALUES ('admin', 'admin123', 'Admin');
|
||||
|
||||
-- Create regular users (replace with actual usernames)
|
||||
-- These users will only see records where ManagerName matches their username
|
||||
INSERT INTO [dbo].[BIPUsers] (UserName, Password, UserType) VALUES ('user1', 'password1', 'User');
|
||||
INSERT INTO [dbo].[BIPUsers] (UserName, Password, UserType) VALUES ('user2', 'password2', 'User');
|
||||
|
||||
-- Example: Create users for specific managers
|
||||
-- Replace 'ManagerName1', 'ManagerName2' with actual manager names from your data
|
||||
-- INSERT INTO [dbo].[BIPUsers] (UserName, Password, UserType) VALUES ('张三', 'password123', 'User');
|
||||
-- INSERT INTO [dbo].[BIPUsers] (UserName, Password, UserType) VALUES ('李四', 'password456', 'User');
|
||||
|
||||
-- Verify created users
|
||||
SELECT * FROM [dbo].[BIPUsers];
|
||||
Reference in New Issue
Block a user