⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 securitytests.java

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
            if (CrmsfaSecurity.hasPartyRelationSecurity(security, "CRMSFA_CONTACT", "_REASSIGN", userLogin, "DemoContact2")) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesRep2 has reassign permission for DemoContact2", false, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    // DemoSalesRep3 for DemoContact1    public void testDemoContact1DemoSalesRep3View() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesRep3"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasPartyRelationSecurity(security, "CRMSFA_CONTACT", "_VIEW", userLogin, "DemoContact1")) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesRep3 has view permission for DemoContact1", true, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    public void testDemoContact1DemoSalesRep3Update() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesRep3"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasPartyRelationSecurity(security, "CRMSFA_CONTACT", "_UPDATE", userLogin, "DemoContact1")) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesRep3 has update permission for DemoContact1", true, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    public void testDemoContact1DemoSalesRep3Deactivate() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesRep3"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasPartyRelationSecurity(security, "CRMSFA_CONTACT", "_DEACTIVATE", userLogin, "DemoContact1")) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesRep3 has deactivate permission for DemoContact1", false, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    public void testDemoContact1DemoSalesRep3Reassign() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesRep3"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasPartyRelationSecurity(security, "CRMSFA_CONTACT", "_REASSIGN", userLogin, "DemoContact1")) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesRep3 has reassign permission for DemoContact1", false, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    public void testDemoContact2DemoSalesRep3Reassign() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesRep3"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasPartyRelationSecurity(security, "CRMSFA_CONTACT", "_REASSIGN", userLogin, "DemoContact2")) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesRep3 has reassign permission for DemoContact2", false, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    /**     * Test the CrmsfaSecurity.hasActivityPermission() method.     */     public void testDemoTask1DemoSalesManagerView() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesManager"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasActivityPermission(security, "_VIEW", userLogin, "DemoTask1", "DemoAccount1", null, null)) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesManager can view DemoTask1 which is associated with DemoAccount1", true, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    public void testDemoTask1DemoSalesManagerUpdate() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesManager"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasActivityPermission(security, "_UPDATE", userLogin, "DemoTask1", "DemoAccount1", null, null)) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesManager can update DemoTask1 which is associated with DemoAccount1", true, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    public void testDemoTask1DemoSalesManagerClose() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesManager"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasActivityPermission(security, "_CLOSE", userLogin, "DemoTask1", "DemoAccount1", null, null)) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesManager can close DemoTask1 which is associated with DemoAccount1", true, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    public void testDemoTask1DemoSalesRep1View() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesRep1"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasActivityPermission(security, "_VIEW", userLogin, "DemoTask1", "DemoAccount1", null, null)) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesRep1 can view DemoTask1 which is associated with DemoAccount1", true, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    public void testDemoTask1DemoSalesRep1Update() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesRep1"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasActivityPermission(security, "_UPDATE", userLogin, "DemoTask1", "DemoAccount1", null, null)) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesRep1 can update DemoTask1 which is associated with DemoAccount1", false, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    public void testDemoTask1DemoSalesRep1Close() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesRep1"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasActivityPermission(security, "_CLOSE", userLogin, "DemoTask1", "DemoAccount1", null, null)) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesRep1 can close DemoTask1 which is associated with DemoAccount1", false, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    /**     * Test the CrmsfaSecurity.hasCasePermission() method.     */     public void testDemoCase1DemoSalesManagerView() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesManager"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasCasePermission(security, "_VIEW", userLogin, "DemoCase1")) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesManager can view DemoCase1", true, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    public void testDemoCase1DemoSalesManagerUpdate() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesManager"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasCasePermission(security, "_UPDATE", userLogin, "DemoCase1")) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesManager can update DemoCase1", true, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    public void testDemoCase1DemoSalesManagerClose() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesManager"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasCasePermission(security, "_CLOSE", userLogin, "DemoCase1")) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesManager can close DemoCase1", true, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    public void testDemoCase1DemoSalesRep1View() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesRep1"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasCasePermission(security, "_VIEW", userLogin, "DemoCase1")) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesRep1 can view DemoCase1", true, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    public void testDemoCase1DemoSalesRep1Update() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesRep1"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasCasePermission(security, "_UPDATE", userLogin, "DemoCase1")) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesRep1 can update DemoCase1", false, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }    public void testDemoCase1DemoSalesRep1Close() throws Exception {        try {            GenericValue userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", "DemoSalesRep1"));            boolean hasPermission = false;            if (CrmsfaSecurity.hasCasePermission(security, "_CLOSE", userLogin, "DemoCase1")) {                hasPermission = true;            }            TestCase.assertEquals("DemoSalesRep1 can close DemoCase1", false, hasPermission);        } catch (GenericEntityException ex) {            TestCase.fail(ex.getMessage());        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -