vincentvanbush

vincentvanbush

Hello!
We’ve released Permit - a new open-source project at Curiosum aiming to make it easier to manage permission-based access control in Elixir applications, supporting Ecto, Phoenix and LiveView. Permit exposes a mostly plain-Elixir, DSL-free syntax to reduce developer confusion and avoid a steep learning curve.

Through Permit.Ecto, Permit is the first authorization library for Elixir to automatically convert authorization conditions to Ecto queries, as well as being the first to integrate seamlessly with Phoenix LiveView with Permit.Phoenix .

If you’re interested in securing your controllers and making resource loading and authorization easier, or you used to like cancancan popular with Rails developers, you might find Permit especially useful (it is very far from being a clone of anything, though). See README for usage examples.

Permit consists of three packages:

Links:

Feel free to contribute and enjoy the usage!

Showing Posts 1 to 10

jimsynz

jimsynz

Ash Core Team

This looks like a really great library for those outside of the Ash ecosystem. Congratulations!

Not quite; Ash has had it’s SAT solving policy authorizer which automatically constrains read and write queries to PostgreSQL (as well as any other supported DataLayer) for several years now.

linusdm

linusdm

I’ve seen a similar feature in the LetMe library by @woylie , named “scoped queries” :grinning_face:

Very neat never the less!

vincentvanbush

vincentvanbush OP

We’ve taken a look at this some time ago, and it looks to me that scoped queries still require you to define Ecto queries manually - this is good from a specific standpoint, but the approach here is that most conditions should be convertible automatically.

vincentvanbush

vincentvanbush OP

Thank you for pointing us to this, James.

This escaped our attention somehow, and looks to be tightly coupled with Ash altogether, but we’ll update the documentation and other descriptions to take it into account.

marcin

marcin

Thank you for contributing!

Would you mind to also write few words how it compares to Janus ?

henlou

henlou

I think you have a copypasta in your README, there are 2 functions called show/2

zachallaun

zachallaun

I wrote Janus :slight_smile:

On the surface, it looks like Permit and Janus are very similar! They both prefer plain Elixir and a single source of truth – the same authz rules are used for individual resources as well as scoped Ecto queries.

Permit seems much more feature-complete (Phoenix/LiveView integration) and has corporate backing, which makes it very attractive! I need to look at Permit more carefully, but I’d love to see if there’s anything novel in Janus that could be ported to Permit and potentially retire Janus if they’re as similar as I think they are.

ketupia

ketupia

Hi,

I just tried installing the latest versions of {:permit_ecto, “~> 0.2.0”} and {:permit_phoenix, “~> 0.1.0”} and am getting a dependency conflict:

Because permit_ecto >= 0.2.0 depends on permit ~> 0.2 and permit_phoenix >= 0.1.0 depends on permit ~> 0.1.3, permit_ecto >= 0.2.0 is incompatible with permit_phoenix >= 0.1.0.
And because your app depends on permit_ecto ~> 0.2.0, permit_phoenix >= 0.1.0 is forbidden.
So, because your app depends on permit_phoenix ~> 0.1.0, version solving failed.

Looks like permit_ecto just got bumped. Can I expect an update to permit_phoenix soon?

Thank you

ketupia

ketupia

I’ve started using permit_ecto and the accessible_by! function is working. E.g., it is restricting which schema objects a user can read but am having trouble when checking authorization.

Background
In my case a User Participates in Games. The participant table is a join of the game_id and user_id. In my Ecto schema, Game has a belongs_to :user for the owner and has_many :participants for the players.

What works
Authorization.accessible_by! and Authorization.read? agree if I make a permit read on the user_id field of the game. That is checking the read? authorization returns true for games returned with accessible_by!

    permit()
    |> read(Game, user_id: id)

What’s not working
When I set the read permit based on the participant association, Authorization.accessible_by! returns the correctly restricted list of games but the read? authorization returns false.

    permit()
    |> read(Game, participants: [user_id: id])

Should this work or should I be declaring permit.can some other way?

vincentvanbush

vincentvanbush OP

Hey!
I apologize for my lack of responses here for the past year - the good news is that there are much more resources dedicated to developing the library actively now; long story short, I’ll be more actively responding to any issues arising. @ketupia , thank you for your comment - I will check it out and let you know.

Recently, we’ve updated the libraries with several additions as well as creating the Permit.Absinthe proof-of-concept to add Permit-based authorization into GraphQL APIs.

Most notably, we’ve added Phoenix LiveView v1.0 and Streams support, and added a more convenient way to check permissions for dynamically given action names.

Changelogs:

https://github.com/curiosum-dev/permit/blob/master/CHANGELOG.md
https://github.com/curiosum-dev/permit_ecto/blob/master/CHANGELOG.md
https://github.com/curiosum-dev/permit_phoenix/blob/master/CHANGELOG.md

Read more: Permit Updates: Phoenix LiveView 1.0 and Absinthe Integration | Curiosum

Where Next? Top

Trending in Announcing Top

woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
fuelen
Hi all! I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas. You...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
akoutmos
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews