mrc logo mrc logo
  • m-Power m-Power
    What is m-Power?
    Overview Demos Build Process Case Studies Specs Pricing Trial
    m-Power Resources
    Overview How-To Videos Webinars & Podcasts White Papers Fact Sheets
  • Solutions Solutions
    What does m-Power build?
    Overview Database Front-Ends Reporting CRM Systems Business Intelligence Dashboards Inventory Management Mobile Apps ERP Enhancements Modernization Spreadsheets to the web MS Access to the web B2B/Web Portals Scheduling Embedded Analytics Web Forms Workflow Data Exploration Budgeting & Forecasting APIs and Web Services Db2 Web Query Alternative
    Solutions by Industry
    Overview Manufacturing Government Foodservice Software Vendors Logistics & Supply Chain Software Consultants Healthcare
  • Services Services
    Development Services Training Mentoring
  • About About
    Overview Partners Press Releases Careers Events Contact Blog
  • Support Support
    Support Home FAQ Documentation Customer Portal Enhancements Updates Roadmap Techblog
Try m-Power

m-Power Manual

Browse:

  • Home
  • Retrievals
  • Row Level Security Template
Back to Manual

Row Level Security

 

Jump to:

Creating the Security Table
Creating the Security Application
Implementing Row Level Security
Video
Web Parameters

Row Level Security is a highly flexible technique for controlling which records are returned based on the current user. Implementing row level security is a three step process. First, you must create a table that contains security credentials. Second, you need to create a retrieval over this table, using the Row Level Security template. Lastly, you must integrate the security retrieval with the application you wish to secure.

Creating the Security Table:

The table must contain three fields. One field will hold user profile information, another will contain values, and a third will contain data regarding the relationship between the user and the values. When naming your fields, do not name the user profile field USER. This word is reserved within Java. Valid relationship values are:

    EQ Equal to
    GE Greater than or equal to
    GT Greater than
    LE Less than or equal to
    LS Is in the list
    LT Less than
    NE Not equal to
    NG Not greater than
    NL Not less than
    RG Is in the range
    SW Starts with

You most likely will want to build a maintainer over this table.

row_level_1

This table has been set up so that user Duffey has the credentials to view all values in the list of OH, IL, and IN. Conversely, user Hurckes can only view values related to CA, MO, and WA. Once your security table has been created, you are ready to create the Row Level Security application.

Back to the Top

Creating the Security Application

In order to implement Row Level Security, you must create a retrieval over the table you just created. This retrieval must be created using the Row Level Security template. Applications created with this template are expected to run behind the scenes, and not in the browser.

Note: The security application must be created in the same data dictionary as the application it will secure.

Application Specifications

Application Settings

Description: Allow developers to specify their application's description/name.

Program Name: This will be the application's number. By default, m-Power uses the letter I (Inquiry) followed by a five digit number.

Select Only Matching Records: Select either 'No', for a left outer join, or 'Yes' for an inner join. A left outer join will return all records from the primary table along with matching records from the secondary tables. An inner join will return records from the primary and secondary tables only where matching records are found.

Template: You can select a template by scrolling through the available templates. The templates define the general layout and functionality of the resulting application. This section will list all the available maintenance templates; you will see a small screenshot of what that template looks like at runtime. Learn more about templates.

Data Selection

Here you will see/modify the table you have selected for your application. Here you can create or modify joins to other tables as well.

Sequencing

Sequence your application by the field containing the user values.

Field Settings

Here you will find the settings for all the fields in the application. The options are:

Note: When creating the security application, please ensure that the third field in your application is the field you wish to secure against.

Delete: You can delete fields by clicking the checkbox and clicking Accept. If a field has a red circle with a cross line, that means that the field is being used somewhere else in the application (sequence, calculation, etc.), and, due to this dependency, is not available for deletion.
NOTE: deleting a field will remove the field from the application only, the table will be unchanged.

Field: This is the same name the field has in the table.

Table: The name of the table where that field exists.

Field Description: This is the text that will appear in the column header for that field, you can modify this field to suit your needs. This field will populate with the field description from the table by default, but it can be customized at the application level.

Display: A radio button allows developers to display or hide the field from the output page. There may be situations where a field is needed for calculation purposes, but the field does not need to be displayed at runtime.

Length: Here you can modify the length of the field. m-Power will only allow developers to shorten the length of the field, shortening a fields length will truncate its data. For example, if a field is 10 alpha and it is changed to 5 alpha, now only the first 5 characters will be displayed. The same principle applies to a numeric field, if a numeric field is 8 digits long; changing it to 4 digits long will only display the first 4 digits, and leave out the rest of digits.

Decimals: For numeric fields, you can modify the amount of decimal digits. A numeric field will have the option of changing its decimal length, alpha fields does not have a decimal option, developers can use this as an indicator to check if a field is a numeric or character type.

Numeric Format Code: For numeric fields, you can modify the way the numbers will display, this includes displaying decimals or not, how to display negative numbers, etc. Multiple formats are built in for developers to use, shall you need a different format code, m-Power allows developers to create their own User Defined Format codes; these codes will add logic for common types of fields such as: Currency, Time, or Dates. Accessing the User Defined Format Codes from the Admin section will also allow developers to modify current codes. Learn more.

Note: Do not confuse the User Defined Format Code with the User Defined Functions (UDF). The latter is a feature that allows developers to create or incorporate programing functions into m-Power. Learn more about UDFs.

User def: This feature has been deprecated.

Record Selections

Record Selections can be created over any database fields. These are the options:

Field: A drop down allows you to select the field you want to filter on.

Relation: A drop down allows you to select a relationship for the filter.

Value: This is the value to compare against. The options are:

Constant Value: A constant value allows you to hard-code any given value into a selection. This value cannot be modified by the end-user at runâ??time.

Application Field Value: Developers have the option of comparing a value from one field to a value from another field within the same record.

And/Or: When creating multiple record selections, you have the option to set them as and or or Example: selection A and selection B will display only records that match both selections. Selection A or selection B will display records that match one or both selections. Learn more.

Calculations

Calculations are a very powerful feature of m-Power; with calculations, developers can create logical fields that will apply to the current application only. This can be used to include SQL code in a field, such as cast a numeric field as character, create date conversions, inserting the current date and time, and much more. Learn more. In Row Level Security applications, calculations are often used to create the relationship field, without needing to alter the table.

External Objects and SmartLinks

External Objects and SmartLinks are not supported in the Row Level Security Template.

Application Properties

When accessing the Application Properties, a popup window will open with multiple tabs; let's go through each of the tabs:

Program Options

debug: Selecting Yes will display the SQL generated by m-Power at runtime, at the bottom of the page. This allows developers to debug the application to see exactly what is being queried to the database. The default setting is No.

edit_type: This property specifies whether this application can be edited through m-Painter (WYSIWYG and text editing), or through text editing only.

SQL Statement

caseSensitive: When using record selections or creating filters via the Selection window, if no matches are found but you know matching records exist, m-Power offers three options for case sensitivity. Change the search value to uppercase is the default, most databases use uppercase when writing data to the table, so this selection will uppercase the values typed in the input field by the end user. Selecting No case conversion will not uppercase the uses input, use this option if know the data in the database are lowercase. The third option is Change both the search value and the DB field to uppercase using the UPPER keyword this will uppercase both the database and the users input, this option is the slowest because the data needs to be read from the table and changed to uppercase, this is done for every record in the table. More Information

secureby: m-Power applications can be secured against username or session ID. Click here to learn more about this feature.

sql_statement: Developers can specify an SQL statement with this property to override the default SQL statement created by the application.

Override Properties

This section allow developers to override the default error messages , by selecting the error message you wish to customize, and then simply modifying the Value section to whatever you would like your message to say at runtime in place of the default message. More Information

Back to the Top

Implementing Row Level Security

Once you've created your security table and retrieval, all that is left to do is to integrate the security retrieval with the application you wish to secure. To do so, open the application and navigate to the Record Selections specification.

For the field value, select the field in your application that contains user information. Select 'Row Level Security' from the relation dropdown. The value dropdown list will populate with all row level security templates that have been created in this dictionary. Select your security application and click accept.

row_level_2

Once you have added your record selection, you will need to recompile your application. However, you do not need to overwrite the HTML or Application Properties. Your application should now be set to use Row Level Security!

Back to the Top

Video

In this brief video I will show you how to apply Row Level security to your applications.
Row level security is a great feature that allows you to specify what records your users can access based on their login credentials. This gives you great control over who can access the records and what records they can access.
Once the security table and the Row Level Security retrieval have been created, you are ready to apply the Row Level security to your application.
As you can see, I have a report listing all the customers; there are over two hundred records listing customers from many different States and regions. I am assigned to work only with customers from the Midwest, which includes these four states: OH, IL, IA, and IN. There is no need for me to see records of customers from other states.
In the security retrieval I had filtered that my user â??Zarateâ?? should only be able to access the records where the State is equal to any of these: OH, IL, IA, and IN.
After compiling your application, click Record Selections. From the Field drop down, select the field that you want to control. In my case the field is the Customer state.
From the Selections drop down, select the Row Level Security. From the Values drop down, select the retrieval containing the users and filters for this application. In my case the retrieval 20 contains the filters of what records I can access depending on the user.
Recompile the application without overriding the HTML or Properties. Now, when I run the application I am only allowed to access those records that match my filter on the retrieval.

Back to the Top

Web Parameters

Back to the Top

Created: October 1, 2013 | Modified: February 20, 2018

Search


Browse By Category

Build Process (13)
Starting with m-Power (8)
Retrievals (10)
Reports (15)
Summaries (4)
Maintainers (17)
Graphs (8)
m-Power Data Explorer (4)
General (24)
Calculations (5)
Utilities (9)
m-Power Administration (23)
Security (11)
Freemarker (6)
m-Painter (29)
Form Validation (5)
External Objects & UDFs (12)
Deprecated Documentation (23)
Bootstrap Templates (7)

Popular Tags

Dates Graph Properties Video Maintainers Report Administration Popular Production Security Compiling Retrievals Database Parameters DB2 Getting Started Record Selections Java Bootstrap Templates RPG App Properties Email Maintainer Performance Form Validation Summaries mrc-Productivity Series Freemarker Retrieval Bar Graphs SQL Data Dictionary Reports Calculations Admin Dropdowns Prompt Screens Graphs Application Properties Excel Tomcat m-Painter Graphing Advanced Build Process External Objects

See all tags »

michaels, ross & cole, ltd. (mrc)

Privacy Policy Cookie Policy Cookie Settings Notice at Collection Do Not Sell or Share My Personal Information

mrc (US)

2001 Midwest Road
Suite 310
Oak Brook, IL 60523
630-916-0662

mrc (UK)

Mortlake Business Centre
20 Mortlake High Street
London, SW14 8JN
+44-20-335-59566


© 2024 mrc. All rights reserved.