Jump to content
We've recently updated our Privacy Statement, available here ×

How to use Domain Security file.


jeevanjoy414

Recommended Posts

Can anyone please tell me how to add secutiry file in domain which is a XML file. And create Adhoc view through that domain and create users to restrict them to get data they are only supposed to get.

This is my Domain Design in XML format.

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.jaspersoft.com/2007/SL/XMLSchema" version="1.0">
  <itemGroups>
    <itemGroup description="Product family and department" descriptionId="" id="Products" label="Products" labelId="" resourceId="JoinTree_1">
      <items>
        <item description="Department" descriptionId="" dimensionOrMeasure="Dimension" id="Department" label="Department" labelId="" resourceId="JoinTree_1.public_product_class.product_department" />
        <item description="Family" descriptionId="" dimensionOrMeasure="Dimension" id="Family" label="Family" labelId="" resourceId="JoinTree_1.public_product_class.product_family" />
      </items>
    </itemGroup>
    <itemGroup description="Geography" descriptionId="" id="Geography" label="Geography" labelId="" resourceId="JoinTree_1">
      <items>
        <item description="City" descriptionId="" dimensionOrMeasure="Dimension" id="City" label="City" labelId="" resourceId="JoinTree_1.public_store.store_city" />
        <item description="Country" descriptionId="" dimensionOrMeasure="Dimension" id="Country" label="Country" labelId="" resourceId="JoinTree_1.public_store.store_country" />
        <item description="State" descriptionId="" dimensionOrMeasure="Dimension" id="State" label="State" labelId="" resourceId="JoinTree_1.public_store.store_state" />
      </items>
    </itemGroup>
    <itemGroup description="Sales Data" descriptionId="" id="SalesData" label="Sales Data" labelId="" resourceId="JoinTree_1">
      <items>
        <item description="Store Cost" descriptionId="" dimensionOrMeasure="Measure" id="StoreCost" label="Store Cost" labelId="" resourceId="JoinTree_1.public_sales_fact_1997.store_cost" />
        <item description="Store Sales" descriptionId="" dimensionOrMeasure="Measure" id="StoreSales" label="Store Sales" labelId="" resourceId="JoinTree_1.public_sales_fact_1997.store_sales" />
        <item description="Unit Sales" descriptionId="" dimensionOrMeasure="Measure" id="UnitSales" label="Unit Sales" labelId="" resourceId="JoinTree_1.public_sales_fact_1997.unit_sales" />
      </items>
    </itemGroup>
  </itemGroups>
  <resources>
    <jdbcTable id="public_product" datasourceId="FoodmartDataSource" tableName="public.product">
      <fieldList>
        <field id="brand_name" type="java.lang.String" />
        <field id="cases_per_pallet" type="java.lang.Short" />
        <field id="gross_weight" type="java.lang.Double" />
        <field id="low_fat" type="java.lang.Boolean" />
        <field id="net_weight" type="java.lang.Double" />
        <field id="product_class_id" type="java.lang.Integer" />
        <field id="product_id" type="java.lang.Integer" />
        <field id="product_name" type="java.lang.String" />
        <field id="recyclable_package" type="java.lang.Boolean" />
        <field id="shelf_depth" type="java.lang.Double" />
        <field id="shelf_height" type="java.lang.Double" />
        <field id="shelf_width" type="java.lang.Double" />
        <field id="sku" type="java.lang.Long" />
        <field id="srp" type="java.math.BigDecimal" />
        <field id="units_per_case" type="java.lang.Short" />
      </fieldList>
    </jdbcTable>
    <jdbcTable id="public_product_class" datasourceId="FoodmartDataSource" tableName="public.product_class">
      <fieldList>
        <field id="product_category" type="java.lang.String" />
        <field id="product_class_id" type="java.lang.Integer" />
        <field id="product_department" type="java.lang.String" />
        <field id="product_family" type="java.lang.String" />
        <field id="product_subcategory" type="java.lang.String" />
      </fieldList>
    </jdbcTable>
    <jdbcTable id="public_sales_fact_1997" datasourceId="FoodmartDataSource" tableName="public.sales_fact_1997">
      <fieldList>
        <field id="customer_id" type="java.lang.Integer" />
        <field id="product_id" type="java.lang.Integer" />
        <field id="promotion_id" type="java.lang.Integer" />
        <field id="store_cost" type="java.math.BigDecimal" />
        <field id="store_id" type="java.lang.Integer" />
        <field id="store_sales" type="java.math.BigDecimal" />
        <field id="time_id" type="java.lang.Integer" />
        <field id="unit_sales" type="java.math.BigDecimal" />
      </fieldList>
    </jdbcTable>
    <jdbcTable id="public_store" datasourceId="FoodmartDataSource" tableName="public.store">
      <fieldList>
        <field id="coffee_bar" type="java.lang.Boolean" />
        <field id="first_opened_date" type="java.sql.Timestamp" />
        <field id="florist" type="java.lang.Boolean" />
        <field id="frozen_sqft" type="java.lang.Integer" />
        <field id="grocery_sqft" type="java.lang.Integer" />
        <field id="last_remodel_date" type="java.sql.Timestamp" />
        <field id="meat_sqft" type="java.lang.Integer" />
        <field id="prepared_food" type="java.lang.Boolean" />
        <field id="region_id" type="java.lang.Integer" />
        <field id="salad_bar" type="java.lang.Boolean" />
        <field id="store_city" type="java.lang.String" />
        <field id="store_country" type="java.lang.String" />
        <field id="store_fax" type="java.lang.String" />
        <field id="store_id" type="java.lang.Integer" />
        <field id="store_manager" type="java.lang.String" />
        <field id="store_name" type="java.lang.String" />
        <field id="store_number" type="java.lang.Integer" />
        <field id="store_phone" type="java.lang.String" />
        <field id="store_postal_code" type="java.lang.String" />
        <field id="store_sqft" type="java.lang.Integer" />
        <field id="store_state" type="java.lang.String" />
        <field id="store_street_address" type="java.lang.String" />
        <field id="store_type" type="java.lang.String" />
        <field id="video_store" type="java.lang.Boolean" />
      </fieldList>
    </jdbcTable>
    <jdbcTable id="JoinTree_1" datasourceId="FoodmartDataSource" tableName="public.product">
      <fieldList>
        <field id="public_sales_fact_1997.customer_id" type="java.lang.Integer" />
        <field id="public_sales_fact_1997.product_id" type="java.lang.Integer" />
        <field id="public_sales_fact_1997.promotion_id" type="java.lang.Integer" />
        <field id="public_sales_fact_1997.store_cost" type="java.math.BigDecimal" />
        <field id="public_sales_fact_1997.store_id" type="java.lang.Integer" />
        <field id="public_sales_fact_1997.store_sales" type="java.math.BigDecimal" />
        <field id="public_sales_fact_1997.time_id" type="java.lang.Integer" />
        <field id="public_sales_fact_1997.unit_sales" type="java.math.BigDecimal" />
        <field id="public_product_class.product_category" type="java.lang.String" />
        <field id="public_product_class.product_class_id" type="java.lang.Integer" />
        <field id="public_product_class.product_department" type="java.lang.String" />
        <field id="public_product_class.product_family" type="java.lang.String" />
        <field id="public_product_class.product_subcategory" type="java.lang.String" />
        <field id="public_product.brand_name" type="java.lang.String" />
        <field id="public_product.cases_per_pallet" type="java.lang.Short" />
        <field id="public_product.gross_weight" type="java.lang.Double" />
        <field id="public_product.low_fat" type="java.lang.Boolean" />
        <field id="public_product.net_weight" type="java.lang.Double" />
        <field id="public_product.product_class_id" type="java.lang.Integer" />
        <field id="public_product.product_id" type="java.lang.Integer" />
        <field id="public_product.product_name" type="java.lang.String" />
        <field id="public_product.recyclable_package" type="java.lang.Boolean" />
        <field id="public_product.shelf_depth" type="java.lang.Double" />
        <field id="public_product.shelf_height" type="java.lang.Double" />
        <field id="public_product.shelf_width" type="java.lang.Double" />
        <field id="public_product.sku" type="java.lang.Long" />
        <field id="public_product.srp" type="java.math.BigDecimal" />
        <field id="public_product.units_per_case" type="java.lang.Short" />
        <field id="public_store.coffee_bar" type="java.lang.Boolean" />
        <field id="public_store.first_opened_date" type="java.sql.Timestamp" />
        <field id="public_store.florist" type="java.lang.Boolean" />
        <field id="public_store.frozen_sqft" type="java.lang.Integer" />
        <field id="public_store.grocery_sqft" type="java.lang.Integer" />
        <field id="public_store.last_remodel_date" type="java.sql.Timestamp" />
        <field id="public_store.meat_sqft" type="java.lang.Integer" />
        <field id="public_store.prepared_food" type="java.lang.Boolean" />
        <field id="public_store.region_id" type="java.lang.Integer" />
        <field id="public_store.salad_bar" type="java.lang.Boolean" />
        <field id="public_store.store_city" type="java.lang.String" />
        <field id="public_store.store_country" type="java.lang.String" />
        <field id="public_store.store_fax" type="java.lang.String" />
        <field id="public_store.store_id" type="java.lang.Integer" />
        <field id="public_store.store_manager" type="java.lang.String" />
        <field id="public_store.store_name" type="java.lang.String" />
        <field id="public_store.store_number" type="java.lang.Integer" />
        <field id="public_store.store_phone" type="java.lang.String" />
        <field id="public_store.store_postal_code" type="java.lang.String" />
        <field id="public_store.store_sqft" type="java.lang.Integer" />
        <field id="public_store.store_state" type="java.lang.String" />
        <field id="public_store.store_street_address" type="java.lang.String" />
        <field id="public_store.store_type" type="java.lang.String" />
        <field id="public_store.video_store" type="java.lang.Boolean" />
      </fieldList>
      <joinInfo alias="public_product" referenceId="public_product" />
      <joinedDataSetList>
        <joinedDataSetRef>
          <joinString>join public_product_class public_product_class on (public_product.product_class_id == public_product_class.product_class_id)</joinString>
        </joinedDataSetRef>
        <joinedDataSetRef>
          <joinString>join public_sales_fact_1997 public_sales_fact_1997 on (public_product.product_id == public_sales_fact_1997.product_id)</joinString>
        </joinedDataSetRef>
        <joinedDataSetRef>
          <joinString>join public_store public_store on (public_sales_fact_1997.store_id == public_store.store_id)</joinString>
        </joinedDataSetRef>
      </joinedDataSetList>
    </jdbcTable>
  </resources>
</schema>
 
 
This is my Security file (.XML)
<securityDefinition xmlns="http://www.jaspersoft.com/2007/SL/XMLSchema" version="1.0" itemGroupDefaultAccess="granted">
<resourceAccessGrants>
  <!-- Row level security -->  
  <!-- What access do roles/users have to the rows in the resource? -->
  <resourceAccessGrantList id="FoodmartDataSource" label="ListLabel"
    resourceId="JoinTree_1">
    <resourceAccessGrants>    
      <!-- Row level for Cities -->
      <resourceAccessGrant id="Jointree_1_row_access_grant_20">
        <principalExpression><![CDATA[authentication.principal.attributes.any 
          {it.attrName in ['Cities'] }]]></principalExpression>
        <filterExpression>testProfileAttribute(public_store.store_city,'Cities')
        </filterExpression>
      </resourceAccessGrant>
      <!-- Row level for Product Dept -->
      <resourceAccessGrant id="Jointree_1_row_access_grant_30"> 
        <principalExpression><![CDATA[authentication.getPrincipal().getAttributes().any
          {it.getAttrName() in ['ProductDepartment'] }]]></principalExpression>
        <filterExpression>testProfileAttribute(public_product_class.product_department,
          'ProductDepartment')</filterExpression>
      </resourceAccessGrant> 
    </resourceAccessGrants>    
  </resourceAccessGrantList>
</resourceAccessGrants>
</securityDefinition>
 
 
 

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...