Git Product home page Git Product logo

Comments (3)

kolotaev avatar kolotaev commented on May 26, 2024 1

@anton-khodak, you probably might be interested:
The functionality we've discussed here is implemented in vakt >= 1.2.
See examples and updated documentation.

Thanks for the issue.

from vakt.

kolotaev avatar kolotaev commented on May 26, 2024

Hi @anton-khodak,

Generally speaking vakt is not as opinionated and maybe powerful as other ABAC implementations found in the wild in defining attributes. It's more a "policy-based access control" part of ABAC definition per se. But from another perspective it's somewhat more flexible since it allows you to build your own vision on setting attributes.

Answering your question (2 variants since I haven't clearly understood the scenario), one possible way to do it with vakt:
You can create a Policy like:

    Policy(
        uid=12345,
        effect=ALLOW_ACCESS,
        subjects=['username=<.*>;position=<owner|collaborator>'], # `;` and `=` here are arbitrary delimiters
        resources=('some-resource-definition'),
        actions=['<read|update>'],
        rules={
            'dataset-ids': InList(['a', 'b', 'c', 'd', 'e']),
        },
    )

and build an Inquiry:

Inquiry(subject='username=max;position=collaborator', action='read', context={'dataset-ids':'d'})

where InList is a custom rule that is, for example, satisfied when 'd' can be found in ['a', 'b', 'c', 'd', 'e'].

Every time you add an additional ID to your system you should update the corresponding '12345' Policy 'dataset-ids' rule with a new list of IDs that is [old-list] + new-id.

If your resource is the dataset-IDs you are talking about, then possible way:

    Policy(
        uid=12345,
        effect=ALLOW_ACCESS,
        subjects=['username=<.*>;position=<owner|collaborator>'], # `;` and `=` here are arbitrary delimiters
        resources=['dataset:1', 'dataset:2'], # imagine 2 possible datasets each with some information like IDs
        actions=['dataset:id:<add|remove>', 'delete'] # add/remove id from dataset; delete - action that deletes the whole dataset
    )
Inquiry(subject='username=max;position=collaborator', action='dataset:id:add', resource='dataset:1') # allowed

Inquiry(subject='username=jerry;position=contributor', action='dataset:id:add', resource='dataset:1') # rejected

Inquiry(subject='username=kim;position=owner', action='dataset:id:remove', resource='dataset:3') # rejected

from vakt.

kolotaev avatar kolotaev commented on May 26, 2024

Is planned to be implemented in #4.

from vakt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.