> On Feb. 8, 2018, 1:30 p.m., Zsombor Gegesy wrote: > > security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java > > Lines 3140 (patched) > > <https://reviews.apache.org/r/65567/diff/1/?file=1954514#file1954514line3140> > > > > You can create a > > 'daoMgr.getXXPolicyLabelMap().deleteByPolicyId(policy.getId())' method, > > which just calls one simple sql delete statement, something like: > > > > delete = em.createQuery( > > "DELETE FROM XPolicyLabelMap pol WHERE pol.policyId = :id"); > > delete.setParameter("id", id); > > delete.executeUpdate();
Yes, we can do that but just following the standard which are used for deleting the Policy Resources, Items, Users and Groups. > On Feb. 8, 2018, 1:30 p.m., Zsombor Gegesy wrote: > > security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java > > Lines 3184 (patched) > > <https://reviews.apache.org/r/65567/diff/1/?file=1954514#file1954514line3184> > > > > First, the deleteExistingPolicyLabel do the same, why the duplication ? > > Second, the xxPolicyLabelMap.getPolicyId() will return the same ID in > > the loop, so no need to iterate, the first delete will delete all the > > records. Method deleteExistingPolicyLabel is used for deleting policy while deleteExistingPolicyLabelNative is used for deleting service - bhavik ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/65567/#review197082 ----------------------------------------------------------- On Feb. 14, 2018, 12:06 p.m., bhavik patel wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/65567/ > ----------------------------------------------------------- > > (Updated Feb. 14, 2018, 12:06 p.m.) > > > Review request for ranger, Ankita Sinha, Don Bosco Durai, Gautam Borad, Abhay > Kulkarni, Madhan Neethiraj, Pradeep Agrawal, Ramesh Mani, Selvamohan > Neethiraj, Sailaja Polavarapu, and Velmurugan Periasamy. > > > Bugs: RANGER-1972 > https://issues.apache.org/jira/browse/RANGER-1972 > > > Repository: ranger > > > Description > ------- > > In Ranger Admin, need a feature to be able to group (for example by tenant > name or business unit) sets of policies with one or more labels that are > relevant to business. > Furthermore, Need to able to search policies on this additional set of > labels. This will be useful for export/import policies as well. > > > Diffs > ----- > > > agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java > 60daed9 > > agents-common/src/main/java/org/apache/ranger/plugin/store/AbstractPredicateUtil.java > 7583864 > agents-common/src/main/java/org/apache/ranger/plugin/util/SearchFilter.java > fa4f767 > security-admin/db/mysql/optimized/current/ranger_core_db_mysql.sql 69f3768 > security-admin/db/mysql/patches/030-policy-labels-schema.sql PRE-CREATION > security-admin/db/oracle/optimized/current/ranger_core_db_oracle.sql > 5abbcd0 > security-admin/db/oracle/patches/030-policy-labels-schema.sql PRE-CREATION > security-admin/db/postgres/optimized/current/ranger_core_db_postgres.sql > 6dfc841 > security-admin/db/postgres/patches/030-policy-labels-schema.sql > PRE-CREATION > > security-admin/db/sqlanywhere/optimized/current/ranger_core_db_sqlanywhere.sql > d555501 > security-admin/db/sqlanywhere/patches/030-policy-labels-schema.sql > PRE-CREATION > security-admin/db/sqlserver/optimized/current/ranger_core_db_sqlserver.sql > a2be2d4 > security-admin/db/sqlserver/patches/030-policy-labels-schema.sql > PRE-CREATION > > security-admin/src/main/java/org/apache/ranger/biz/RangerPolicyRetriever.java > 1b6f440 > security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java > 7aee433 > security-admin/src/main/java/org/apache/ranger/common/RangerSearchUtil.java > 92b0e03 > security-admin/src/main/java/org/apache/ranger/db/RangerDaoManagerBase.java > db20a14 > security-admin/src/main/java/org/apache/ranger/db/XXPolicyLabelDao.java > PRE-CREATION > security-admin/src/main/java/org/apache/ranger/db/XXPolicyLabelMapDao.java > PRE-CREATION > security-admin/src/main/java/org/apache/ranger/entity/XXPolicyLabel.java > PRE-CREATION > security-admin/src/main/java/org/apache/ranger/entity/XXPolicyLabelMap.java > PRE-CREATION > security-admin/src/main/java/org/apache/ranger/rest/ServiceREST.java > 9e4d799 > > security-admin/src/main/java/org/apache/ranger/service/RangerPolicyLabelsService.java > PRE-CREATION > > security-admin/src/main/java/org/apache/ranger/service/RangerPolicyService.java > 5aec948 > > security-admin/src/main/java/org/apache/ranger/service/RangerPolicyServiceBase.java > 5d3af2f > security-admin/src/main/java/org/apache/ranger/view/VXPolicy.java c73d42b > security-admin/src/main/java/org/apache/ranger/view/VXPolicyLabel.java > PRE-CREATION > security-admin/src/main/java/org/apache/ranger/view/VXPolicyLabelList.java > PRE-CREATION > security-admin/src/main/resources/META-INF/jpa_named_queries.xml 786b4bf > security-admin/src/main/webapp/scripts/models/RangerPolicy.js b5a274a > security-admin/src/main/webapp/scripts/modules/globalize/message/en.js > b71427c > security-admin/src/main/webapp/scripts/utils/XAUtils.js 8fa7fca > security-admin/src/main/webapp/scripts/views/policies/RangerPolicyDetail.js > 5bf2296 > security-admin/src/main/webapp/scripts/views/policies/RangerPolicyForm.js > 542147f > security-admin/src/main/webapp/scripts/views/policies/RangerPolicyRO.js > a01350b > > security-admin/src/main/webapp/scripts/views/policies/RangerPolicyTableLayout.js > ce295ff > > security-admin/src/main/webapp/scripts/views/reports/PlugableServiceDiffDetail.js > 914f271 > security-admin/src/main/webapp/scripts/views/reports/UserAccessLayout.js > 90f44c1 > security-admin/src/main/webapp/styles/xa.css ee13655 > > security-admin/src/main/webapp/templates/policies/RangerPolicyDetail_tmpl.html > f8d1791 > security-admin/src/main/webapp/templates/policies/RangerPolicyRO_tmpl.html > f298fd0 > security-admin/src/main/webapp/templates/reports/UserAccessLayout_tmpl.html > 36a7a6e > security-admin/src/test/java/org/apache/ranger/biz/TestServiceDBStore.java > f7eb0d4 > security-admin/src/test/java/org/apache/ranger/rest/TestServiceREST.java > bb97fab > > > Diff: https://reviews.apache.org/r/65567/diff/4/ > > > Testing > ------- > > 1. While creating policy, multiple labels can be assigned also lookup is > working. > 2. On policy listing page admin is able to filter policies based on policy > labels. > 3. On report page also admin is able to filter policies based on policy > labels. > > > Thanks, > > bhavik patel > >