tables · table
userrights
The userrights table is a granular security and access control repository within the SQL Server database. It defines user-specific permissions for every menu item, transaction screen, and report within the ERP system. Each record maps a user_code to a specific formname or menuname, specifying their capability to perform CRUD (Create, Read, Update, Delete) operations. This table is vital for enforcing role-based access control (RBAC) and determining the visibility of UI components based on the menuEnable and mtype flags.
Row count
20,562
Last entry
—
Source
tables
Columns
14| Column | Type | Nullable | Meaning |
|---|---|---|---|
compcode | VARCHAR | No | Unique identifier for the company/entity. |
sno | INT | No | Sequence number for the menu item or right. |
user_code | VARCHAR | No | The unique login or identifier of the user. |
caption | VARCHAR | Yes | Display label for the menu item or button. |
menuname | VARCHAR | Yes | Internal system name for the menu element. |
formname | VARCHAR | Yes | Physical name of the application form/screen. |
menuEnable | CHAR(1) | Yes | Flag indicating if the menu is visible to the user. |
addition | CHAR(1) | Yes | Permission to create/add new records. |
modification | CHAR(1) | Yes | Permission to edit existing records. |
deletion | CHAR(1) | Yes | Permission to remove records. |
enquiry | CHAR(1) | Yes | Permission to view or search data. |
mainform | VARCHAR | Yes | The parent container or module name. |
mtype | CHAR(1) | Yes | Category classification of the menu item. |
OnForm_Object | VARCHAR | Yes | Specific UI control/object level permissions. |
Full documentation
### 1) Overview The `userrights` table is a granular security and access control repository within the SQL Server database. It defines user-specific permissions for every menu item, transaction screen, and report within the ERP system. Each record maps a `user_code` to a specific `formname` or `menuname`, specifying their capability to perform CRUD (Create, Read, Update, Delete) operations. This table is vital for enforcing role-based access control (RBAC) and determining the visibility of UI components based on the `menuEnable` and `mtype` flags. ### 2) Column Dictionary | Column | Type | Nullable | Meaning | Allowed Values | SQL Usage | | :--- | :--- | :--- | :--- | :--- | :--- | | **compcode** | VARCHAR | No | Unique identifier for the company/entity. | E.g., 'DAS' | Used in multi-tenant filtering and joins. | | **sno** | INT | No | Sequence number for the menu item or right. | E.g., 1, 801 | Used for ordering menu displays. | | **user_code** | VARCHAR | No | The unique login or identifier of the user. | E.g., 'jitender', 'krishan' | Primary join key for user-based filtering. | | **caption** | VARCHAR | Yes | Display label for the menu item or button. | E.g., 'Masters', 'Sale Order Export' | Used for UI rendering. | | **menuname** | VARCHAR | Yes | Internal system name for the menu element. | E.g., 'mnuvtrans', 'mnusoa' | Joins with `CompanyConfigMenu`. | | **formname** | VARCHAR | Yes | Physical name of the application form/screen. | E.g., 'frmcustmas', 'frmprod' | Joins with `Form_Active_Status`. | | **menuEnable** | CHAR(1) | Yes | Flag indicating if the menu is visible to the user. | Y, N | Used to dynamically build user menus. | | **addition** | CHAR(1) | Yes | Permission to create/add new records. | Y, N | Logic flag for "Save" button visibility. | | **modification** | CHAR(1) | Yes | Permission to edit existing records. | Y, N | Logic flag for "Edit" button visibility. | | **deletion** | CHAR(1) | Yes | Permission to remove records. | Y, N | Logic flag for "Delete" button visibility. | | **enquiry** | CHAR(1) | Yes | Permission to view or search data. | Y, N, ' ' | Logic flag for "Search/View" access. | | **mainform** | VARCHAR | Yes | The parent container or module name. | E.g., 'frmsms', 'frmprod' | Joins with `CompanyConfigMenu`. | | **mtype** | CHAR(1) | Yes | Category classification of the menu item. | M (Master), T (Transaction), R (Report), V (View), D (Doc) | Used for grouping menu structures. | | **OnForm_Object** | VARCHAR | Yes | Specific UI control/object level permissions. | E.g., 'frmwostatus' | Granular control within a specific form. | ### 3) Relationships & Join Map The `userrights` table acts as the functional extension of user profiles, linking UI components to security policies. #### Primary Joins (Authoritative): * **dbo.UserrightsHdr**: Joins on `compcode` and `user_code`. This provides the header-level module definitions for the specific rights listed here. * **dbo.CompanyConfigMenu**: Joins on `compcode`, `menuname`, and `mainform`. Use this to sync system-wide menu availability with user-specific overrides. * **dbo.pass1 (User Master)**: Joins on `compcode` and `username` (mapped to `user_code`). Used to validate if the user is currently active or locked. * **dbo.Form_Active_Status**: Joins on `compcode` and `form_name` (mapped to `formname`). Used to check if a specific form is globally disabled regardless of user rights. #### Logical/Likely Joins: * **dbo.Deletion_Log**: Joins on `compcode` and `ERP_User` (mapped to `user_code`). Used to audit which user performed a deletion based on their granted rights.