security
Skill9 starsChanged 10 months agoMITView on GitHub
Implements Row-Level Security (RLS) and Object-Level Security (OLS) for Power BI models. Use for data access control, dynamic security, and multi-tenant scenarios.
78 other projects use a version of this.
Adopted by
Most recently taken up by
- AllThingsSmitty/proven-skillstheir own version, first seen Oct 6, 2026
- MarvelCollin/agent-skillstheir own version, first seen Oct 5, 2026
- muon-m2/magento2-toolstheir own version, first seen Oct 4, 2026
- flavien-ia/hypervibe-harnesstheir own version, first seen Oct 4, 2026
- AIBiz-Automatyzacje/claude-code-startertheir own version, first seen Oct 4, 2026
- lgzarturo/codeconductortheir own version, first seen Sep 30, 2026
Used with
Projects with it also use cost-reducer, trigger-dev and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
daianepepes-labSkillcost-reducer
Analyze and reduce costs across cloud infrastructure, code, and services. Use when asked to cut costs, optimize spending, reduce bills, or improve cost efficiency.
Also in 5 projects that use this
xfstudioSkilltrigger-dev
Trigger.dev expert for background jobs, AI workflows, and reliable async execution with excellent developer experience and TypeScript-first design. Use when: trigger.dev, trigger dev, background task, ai background job, long running task.
Also in 4 projects that use this
ffsshhttiikkSkillscalability
Core foundational concepts and principles for Scalability
Also in 4 projects that use this
daianepepes-labSkillself-healing
Detect, diagnose, and automatically fix recurring errors, memory issues, and system degradation. Use when a system has recurring failures, memory leaks, performance degradation, or needs automatic recovery mechanisms.
Also in 5 projects that use this
xfstudioSkillcustomer-support
Elite AI-powered customer support specialist mastering
Also in 4 projects that use this
ffsshhttiikkSkillcicd
Continuous integration and delivery pipelines
Also in 4 projects that use this
- +1 more from daianepepes-lab
Other versions78 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 78
- parcadei/Continuous-Claude-v3★ 3.9ksame name
- BankrBot/skills★ 1.2ksame name
- rshankras/claude-code-apple-skills★ 777same name
- alinaqi/maggy★ 707same name
- boshu2/agentops★ 447same name
- notque/vexjoy-agent★ 424same name
- nth5693/gemini-kit★ 373same name
- telagod/code-abyss★ 242same name
- garagon/nanostack★ 207same name
- TheBeardedBearSAS/claude-craft★ 106same name
68 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository9 other files it gives its agents.
- best-practicesSkill
- calculation-groupsSkill
- daxSkill
- deploymentSkill
- pbip-projectSkill
- power-querySkill
- report-visualsSkill
- semantic-modelSkill
- themesSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. 0 are common, 17 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 56 edited versions we read keep these.
17
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 335
Test as role with specific user
- Distinctive: line 340
Create a measure to debug security:
- Distinctive: line 387
Principle of Least Privilege: - Start restrictive, add access
- Distinctive: line 389
Test All Scenarios: - Every role combination
- Distinctive: line 416
When a user belongs to multiple roles, filters combine with OR:
- Distinctive: line 434
Use USERPRINCIPALNAME() for cloud deployments
- Distinctive: line 435
Create a security mapping table for flexibility
- Distinctive: line 436
Test with "View as" before deployment
- Distinctive: line 438
Document each role's intended audience
- Distinctive: line 441
Never use RLS as the only security layer
- Distinctive: line 442
Don't filter only dimension tables (facts may leak)
- Distinctive: line 443
Avoid complex DAX in filter expressions
- Distinctive: line 444
Never expose administrator role to users
- Distinctive: line 445
Don't rely on RLS for aggregated/composite models
- Distinctive: line 450
Test locally: - Use "View as Roles" in Desktop
- Distinctive: line 453
Assign: - Add users/groups to roles in Service
- Distinctive: line 454
Validate: - Test with actual user accounts
“Common” is measured: kept by at least 6 in 10 of the 56 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Security Skill
This skill helps implement Row-Level Security (RLS) and Object-Level Security (OLS) for Power BI semantic models.
When to Use This Skill
- Restricting data access by user/role
- Implementing dynamic security based on user identity
- Creating multi-tenant data models
- Protecting sensitive columns with OLS
- Setting up manager/hierarchy security
- Testing security configurations
Security Types
| Type | Controls | Use Case |
| RLS (Row-Level Security) | Which rows users can see | Regional sales reps see only their region |
| OLS (Object-Level Security) | Which columns/tables users can see | Hide salary column from non-HR users |
Row-Level Security (RLS)
TMDL Syntax
role 'Sales Representatives'
modelPermission: read
lineageTag: <guid>
tablePermission Sales = 'Sales'[Region] = USERPRINCIPALNAME()Role Structure
role 'RoleName'
modelPermission: read
description: 'Description of who this role is for'
lineageTag: <guid>
tablePermission TableName = <DAX filter expression>
tablePermission AnotherTable = <DAX filter expression>Model Permissions
| Permission | Description |
read | Can read data (standard for RLS) |
administrator | Full access (no filtering) |
none | No access |
Common RLS Patterns
Static Role (Fixed Filter)
/// Role for West region users
role 'West Region'
modelPermission: read
lineageTag: {{guid}}
tablePermission Sales = 'Sales'[Region] = "West"Dynamic Security (User Identity)
/// Each user sees only their own data
role 'User Data'
modelPermission: read
lineageTag: {{guid}}
tablePermission Sales =
'Sales'[User Email] = USERPRINCIPALNAME()Security Table Lookup
/// Users mapped to regions in a security table
role 'Region Security'
modelPermission: read
lineageTag: {{guid}}
tablePermission Sales =
CONTAINS(
FILTER(
'User Region Mapping',
'User Region Mapping'[User Email] = USERPRINCIPALNAME()
),
'User Region Mapping'[Region], 'Sales'[Region]
)Manager Hierarchy
/// Managers see their team's data
role 'Manager Security'
modelPermission: read
lineageTag: {{guid}}
tablePermission Sales =
VAR CurrentUser = USERPRINCIPALNAME()
VAR UserEmployeeID = LOOKUPVALUE(
Employees[Employee ID],
Employees[Email], CurrentUser
)
RETURN
PATHCONTAINS(
'Sales'[Manager Path],
UserEmployeeID
)Multi-Tenant with Tenant ID
/// Each tenant sees only their data
role 'Tenant Isolation'
modelPermission: read
lineageTag: {{guid}}
tablePermission Sales =
VAR UserTenant = LOOKUPVALUE(
Users[Tenant ID],
Users[Email], USERPRINCIPALNAME()
)
RETURN
'Sales'[Tenant ID] = UserTenantMultiple Conditions
/// Users see data for their region AND department
role 'Region and Department'
modelPermission: read
lineageTag: {{guid}}
tablePermission Sales =
VAR CurrentUser = USERPRINCIPALNAME()
VAR UserRegion = LOOKUPVALUE(Users[Region], Users[Email], CurrentUser)
VAR UserDept = LOOKUPVALUE(Users[Department], Users[Email], CurrentUser)
RETURN
'Sales'[Region] = UserRegion &&
'Sales'[Department] = UserDeptDate-Based Access
/// Users can only see data after their start date
role 'Date Restricted'
modelPermission: read
lineageTag: {{guid}}
tablePermission Sales =
VAR UserStartDate = LOOKUPVALUE(
Users[Start Date],
Users[Email], USERPRINCIPALNAME()
)
RETURN
'Sales'[Date] >= UserStartDateSecurity Table Design
User-to-Data Mapping Table
table 'User Security'
lineageTag: {{guid}}
column 'User Email'
dataType: string
lineageTag: {{guid}}
column 'Region'
dataType: string
lineageTag: {{guid}}
column 'Department'
dataType: string
lineageTag: {{guid}}
column 'Access Level'
dataType: string
lineageTag: {{guid}}
partition 'User Security' = m
mode: import
source =
let
Source = Table.FromRows({
{"user1@company.com", "North", "Sales", "Standard"},
{"user2@company.com", "South", "Sales", "Standard"},
{"manager@company.com", "ALL", "Sales", "Manager"}
}, {"User Email", "Region", "Department", "Access Level"})
in
SourceRLS with Security Table
role 'Data Access'
modelPermission: read
lineageTag: {{guid}}
tablePermission Sales =
VAR CurrentUser = USERPRINCIPALNAME()
VAR UserAccessLevel = LOOKUPVALUE(
'User Security'[Access Level],
'User Security'[User Email], CurrentUser
)
VAR UserRegion = LOOKUPVALUE(
'User Security'[Region],
'User Security'[User Email], CurrentUser
)
RETURN
IF(
UserAccessLevel = "Manager" || UserRegion = "ALL",
TRUE(),
'Sales'[Region] = UserRegion
)Object-Level Security (OLS)
Column-Level Security
OLS hides columns from specific roles. In TMDL:
role 'Non-HR Users'
modelPermission: read
lineageTag: {{guid}}
/// Hide salary column
columnPermission Employees.Salary = none
/// Hide SSN column
columnPermission Employees.SSN = noneTable-Level Security
role 'External Users'
modelPermission: read
lineageTag: {{guid}}
/// Completely hide internal table
tablePermission 'Internal Metrics' = falseOLS Permission Values
| Permission | Effect |
none | Column hidden, inaccessible |
read | Column visible (default) |
Combining RLS and OLS
/// Role with both row and column restrictions
role 'Limited Access'
modelPermission: read
lineageTag: {{guid}}
/// Row filter: only see own region
tablePermission Sales = 'Sales'[Region] = LOOKUPVALUE(
Users[Region], Users[Email], USERPRINCIPALNAME()
)
/// Column filter: hide margin columns
columnPermission Sales.'Profit Margin' = none
columnPermission Sales.'Cost' = noneDAX Security Functions
USERPRINCIPALNAME()
Returns the email/UPN of the current user:
USERPRINCIPALNAME() // Returns "user@company.com"USERNAME()
Returns the domain\username (less common in cloud):
USERNAME() // Returns "DOMAIN\username"CUSTOMDATA()
Returns custom data passed via connection string:
CUSTOMDATA() // Returns custom parameter valueUSEROBJECTID()
Returns the Azure AD Object ID:
USEROBJECTID() // Returns GUID of userTesting RLS
In Power BI Desktop
- Modeling tab > View as > Roles
- Select role(s) to test
- Optionally enter "Other user" email
- Click OK to see filtered data
In Power BI Service
- Dataset settings > Security
- Test as role with specific user
- Verify filtered results
Test Measure
Create a measure to debug security:
Security Debug =
VAR CurrentUser = USERPRINCIPALNAME()
VAR UserRegion = LOOKUPVALUE(
'User Security'[Region],
'User Security'[User Email], CurrentUser
)
RETURN
"User: " & CurrentUser & " | Region: " & UserRegionPerformance Considerations
DO
/// GOOD: Direct column comparison
tablePermission Sales = 'Sales'[Region] = LOOKUPVALUE(...)
/// GOOD: Use CONTAINS for multiple values
tablePermission Sales = CONTAINS(
VALUES('User Security'[Region]),
'User Security'[Region], 'Sales'[Region]
)DON'T
/// BAD: Complex DAX in security filter
tablePermission Sales =
CALCULATE(
COUNTROWS(FILTER(...)), // Avoid complex calculations
...
) > 0
/// BAD: Iterating over large tables
tablePermission Sales =
SUMX(LargeTable, ...) // Slow!Security Best Practices
Design Principles
- Principle of Least Privilege - Start restrictive, add access
- Single Security Table - Centralize user mappings
- Test All Scenarios - Every role combination
- Document Roles - Clear descriptions of access levels
- Avoid RLS on Aggregated Models - May expose totals
Common Mistakes
| Mistake | Problem | Fix |
| No default restriction | New users see all data | Use catch-all role |
| Filter only fact table | Dimension data exposed | Filter fact AND dimensions |
| Complex DAX filters | Poor performance | Simplify with lookup tables |
| Hardcoded emails | Maintenance nightmare | Use security table |
| No testing | Security gaps | Test as each role |
Security Checklist
- All fact tables have appropriate filters
- Related dimension tables filtered (if needed)
- Security table maintained and current
- Roles tested with real user emails
- Performance acceptable with security applied
- Documentation of role purposes
- No admin role exposed to end users
- OLS applied to sensitive columns
Multiple Roles
When a user belongs to multiple roles, filters combine with OR:
User in "North Region" AND "Sales Department"
→ Sees: (Region = "North") OR (Department = "Sales")To require AND logic, use a single role with combined filter:
role 'North Sales'
tablePermission Sales =
'Sales'[Region] = "North" && 'Sales'[Department] = "Sales"Boundaries and Constraints
DO
- Use USERPRINCIPALNAME() for cloud deployments
- Create a security mapping table for flexibility
- Test with "View as" before deployment
- Filter at the most granular fact table level
- Document each role's intended audience
DO NOT
- Never use RLS as the only security layer
- Don't filter only dimension tables (facts may leak)
- Avoid complex DAX in filter expressions
- Never expose administrator role to users
- Don't rely on RLS for aggregated/composite models
Workflow Integration
After implementing security:
- Test locally - Use "View as Roles" in Desktop
- Document - Describe each role's purpose
- Deploy - Publish to Power BI Service
- Assign - Add users/groups to roles in Service
- Validate - Test with actual user accounts
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

