Coder Social home page Coder Social logo

Comments (4)

abiusx avatar abiusx commented on August 24, 2024

it is a means of retriving the current (logged in) user ID to check for permissions, cuz its the most common case.
it is left there to be implemented by the developer, but marking it out in a PSR implementatin woul dbe a good idea. Its authentication domain and should not be included in authorization.
-A


Notice: This message is digitally signed, its source and integrity are verifiable.
If you mail client does not support S/MIME verification, it will display a file (smime.p7s), which includes the X.509 certificate and the signature body. Read more at Certified E-Mail with Comodo and Thunderbird in AbiusX.com

On Mordad 31, 1392, at 1:48 AM, Jesse Burns [email protected] wrote:

The 'jf::CurrentUser()' method does not exist, causing errors:

$rbac->Users->HasRole()
$rbac->Users->Assign()
$rbac->Users->Unassign()
$rbac->Users->AllRoles()
$rbac->Users->RoleCount()
$rbac->Users->Enforce()
All of the above throw PHP errors if no '$User/$UserID' parameter is provided ($User/$UserID = null). The proper behavior is to check 'jf::CurrentUser()' for current user id, but if 'jf::CurrentUser()' does not exist we get an error stating that fact.

I'm assuming that 'CurrentUser' is an interface that users of PhpRbac needs to implement, but wanted to verify that.

I was wondering if it might be a good idea to implement CurrentUser() with a default of 0 (zero, for guest), and either allow the user of PhpRbac to override it, or have a setter so users can dynamically update the current UserID.

I've added the following code to the jf class (jb.php) as a temporary fix so I can continue working on Unit Tests:

static function CurrentUser() {
return 0;
}

Reply to this email directly or view it on GitHub.

from rbac.

jburns131 avatar jburns131 commented on August 24, 2024

Thank you. If it's ok with you I will remove any reference to jf::Current user, thus making the user-id mandatory.

I will also update the above mentioned methods and create/throw an exception if the user-id argument is empty.

Sound good?

from rbac.

abiusx avatar abiusx commented on August 24, 2024

gr8


Notice: This message is digitally signed, its source and integrity are verifiable.
If you mail client does not support S/MIME verification, it will display a file (smime.p7s), which includes the X.509 certificate and the signature body. Read more at Certified E-Mail with Comodo and Thunderbird in AbiusX.com

On Shahrivar 1, 1392, at 7:20 AM, Jesse Burns [email protected] wrote:

Thank you. If it's ok with you I will remove any reference to jf::Current user, thus making the user-id mandatory.

I will also update the above mentioned methods and create/throw an exception if the user-id argument is empty.

Sound good?


Reply to this email directly or view it on GitHub.

from rbac.

jburns131 avatar jburns131 commented on August 24, 2024

I've addressed this Issue in commit aebafee

Please review and close Issue if everything looks good to you.

from rbac.

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.