DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Data Privacy and Security: A Developer's Guide to Handling Sensitive Data With DuckDB
  • Using AUTHID Parameter in Oracle PL/SQL
  • Microsoft Azure Backup Service
  • Snowflake Data Encryption and Data Masking Policies

Trending

  • How to Practice TDD With Kotlin
  • DGS GraphQL and Spring Boot
  • How to Configure and Customize the Go SDK for Azure Cosmos DB
  • Agentic AI for Automated Application Security and Vulnerability Management
  1. DZone
  2. Data Engineering
  3. Databases
  4. Row Level Security in Hyperlambda and SQL

Row Level Security in Hyperlambda and SQL

Row level security in Hyperlambda and SQL is a declarative feature when generating your CRUD backend. One simple dropdown list, and it’s done!

By 
Thomas Hansen user avatar
Thomas Hansen
DZone Core CORE ·
Sep. 03, 22 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
5.7K Views

Join the DZone community and get the full member experience.

Join For Free

We’ve always had row-level security in Hyperlambda. However, as of today, row-level security in Hyperlambda and SQL is a declarative feature when generating your CRUD backend. Look at the below screenshot to understand.

simple table I

The above is a simple table I added to the Aista CRM plugin using SQL Studio. The idea is to have a single table where each user can store notes for later. The “owner” field is the username of who’s note the particular record belongs to. No users should have access to other users’ notes. This idea is called “row level security”. If you reproduce the above database table in SQL Studio then go to the CRUD Generator, and select your database and table, you’ll see something like this if you expand the “owner” column.

The above dropdown list allows you to “lock” your field to the username of the authenticated user. This feature will automatically generate all the code required to ensure row-level security on all CRUD operations. Creating records will automatically “inject” the username. The read will only return records belonging to the user. An update will only allow for updating records belonging to the user. And delete till only delete records belonging to the user.

This is a highly useful feature, and the CRUD Generator simply takes care of everything automatically for you. No coding is required from your side.

How Does It Work?

I must have said this a million times before, but it’s impossible to create something resembling our CRUD Generator without a meta-programming language. My reasons for repeating this, are because the first question people ask me when they see Aista Magic Cloud is; “Why didn’t you use PHP or Python? Why this ‘Hyperlambda’ thing?”

My answer is always the same; “It’s not possible without a meta-programming language. As far as I know, Hyperlambda is the only modern meta-programming language in existence.”

The reason is that the tiny dropdown list thing you see in the above screenshot will actually “dynamically inject” Hyperlambda code into a “Hyperlambda template”. This is only possible if you can treat code the same way you treat data. Implying you allow for querying the code semantically, to understand how it works. This process resembles the same process you’re following as you’re injecting HTML elements into your DOM. HTML is a “semantic” language, meaning it’s got no “compilation” occurring. Fundamentally HTML is simply a tree structure. Hyperlambda shares this trait with HTML, it’s just a tree!

This allows the CRUD Generator, and other concepts for the record, to semantically inspect the Hyperlambda, and dynamically inject additional snippets at the correct place, according to your instructions.

Doing this with PHP, Python, C# or Java is not even possible in THEORY!

Below is the SQL necessary to recreate the above table in SQL Studio for your reference.

MySQL
 
CREATE TABLE notes(
  note_id integer not null primary key autoincrement,
  content text not null,
  owner text not null
);
Database security sql

Published at DZone with permission of Thomas Hansen. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Data Privacy and Security: A Developer's Guide to Handling Sensitive Data With DuckDB
  • Using AUTHID Parameter in Oracle PL/SQL
  • Microsoft Azure Backup Service
  • Snowflake Data Encryption and Data Masking Policies

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!