#Modeling Authorization - Permify Docs

1 messages · Page 1 of 1 (latest)

eternal plover
#

Hi @lone ether, can you send your schema so we can observe

lone ether
#

I have used schema from the link that I send


entity organization {

    attribute authority integer

    // organizational roles
    relation admin @user
    relation member @user

    rule check_confidentiality(authority integer) {
        this.authority >= authority
    }
}

entity repository {

    attribute authority integer

    // represents repositories parent organization
    relation parent @organization

    // permissions
    permission edit = parent.check_confidentiality(authority)
}
#

The syntax for defining a rule inside an entity is also not supported by the playground, it gives the same error.

lone ether
#

And can I implement something like this using permify:


entity role {
    attribute permissions string[]

    relation member @user

    rule check_permission(permission_code string) {
        permission_code in this.permissions
    }
}

entity page {
    relation role @role

    // permissions
    permission edit_name = role.check_permission("can_edit_name")
    permission edit_description = role.check_permission("can_edit_description")
}