lonnieezell / myth-auth

One-stop Auth package for CodeIgniter 4
MIT License
633 stars 207 forks source link

Permissions is not an object #469

Closed g3ck0 closed 2 years ago

g3ck0 commented 2 years ago

it may be lame, but the way to use the data pulled from the most parts of the system and permissions is not standard, for the rest of the system we use objects but for permissions there are arrays

for example getting all the groups i can do this:

$result = $authorize->groups();
                foreach ($result as $key => $value) {
                       $data['data'][$key] = array(
                        $value->name,
                        $value->description,
                        $ops,
                    );
                }

but for permissions i have to do this:

$result = $authorize->permissions();

                foreach ($result as $key => $value) {
                    $data['data'][$key] = array(
                        $value['name'],
                        $value['description'],
                        $ops,
                    );
                }
MGatner commented 2 years ago

I agree, but we've been stuck with that original design in order to prevent breaking changes before a major release. You can extend the model and change the $returnType property yourself for a quick fix. Or switch to Shield 🤗

g3ck0 commented 2 years ago

another lame question @MGatner , would you mind give me the link for shield?

MGatner commented 2 years ago

Not lame at all! Here ya go:

While I'm at it here are a couple other (potentially-)helpful auth tools that go along nicely with Myth and Shield:

Disclaimer: those are my authorship.

g3ck0 commented 2 years ago

thank you