Class StoreAccessService

java.lang.Object
org.bgerp.plugin.inventoru.service.StoreAccessService

public class StoreAccessService extends Object
Which warehouses a user may see and change. The rule lives here rather than in an action because it is also needed outside of one — the parameter values of a warehouse are written by the kernel action /user/parameter, which knows nothing about warehouses, and the plugin has to enforce access from an event listener instead.
  • Method Details

    • accessibleStoreIds

      public static Set<Integer> accessibleStoreIds(Connection con, DynActionForm form) throws Exception
      Returns:
      null for an admin-tier user, meaning every warehouse; otherwise the IDs of the warehouses the user owns, has an active StoreAccessDAO grant for, or may edit through the edit_group_id group — possibly an empty set.
      Throws:
      Exception
    • ownStoreIds

      public static Set<Integer> ownStoreIds(Connection con, DynActionForm form) throws Exception
      The warehouses of the user personally, ignoring the admin-tier permission — an admin's "my warehouse" screen has to stay their own, not every warehouse in the system.
      Returns:
      the IDs, possibly empty.
      Throws:
      Exception
    • hasAccess

      public static boolean hasAccess(Connection con, DynActionForm form, int storeId) throws Exception
      Returns:
      whether the user may change the given warehouse.
      Throws:
      Exception