ModulePermissionController controller = new ModulePermissionController(); if (controller.HasModuleAccess(userId, "SalesModule")) { // allow user access } else { // deny user access }
ModulePermissionController controller = new ModulePermissionController(); foreach (var module in modulesList) { if (controller.HasModuleAccess(userId, module.Name)) { // allow user access to the module } }In this example, the controller is used in a loop to check whether a user has access to multiple modules at once. If the user has access to a module, the code inside the "if" block will be executed. The package library for the ModulePermissionController and HasModuleAccess method is most likely part of a larger system or framework, perhaps a custom-built application or a third-party library that manages access control for modules or features. Without more information, it's difficult to determine a specific package library.