Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$rbac->Users->AllRoles() throws error if no parameter is passed #6

Closed
jburns131 opened this issue Aug 21, 2013 · 7 comments
Closed
Assignees
Labels

Comments

@jburns131
Copy link
Collaborator

The comments state,

* @param integer $UserID
*           optional

yet a php error is thrown if no parameters are supplied.

Proposed fix:

Old

function AllRoles($UserID)

New

function AllRoles($UserID = null)
@abiusx
Copy link
Contributor

abiusx commented Aug 22, 2013

ok
nice test
having 100% code coverage will fix these.


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 4:10 AM, Jesse Burns notifications@github.com wrote:

The comments state,

  • @param integer $UserID
  •       optional
    
    yet a php error is thrown if no parameters are supplied.

Proposed fix:

Old

function AllRoles($UserID)
New

function AllRoles($UserID = null)

Reply to this email directly or view it on GitHub.

@jburns131
Copy link
Collaborator Author

As per our discussion in Issue #2, I propose that we make $UserID mandatory and create/throw an Exception if $UserID is null.

@abiusx
Copy link
Contributor

abiusx commented Aug 23, 2013

i belive allRoles should return all roles (not those of the user), check again. if its what you think the soution is right


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 8:13 AM, Jesse Burns notifications@github.com wrote:

As per our discussion in Issue #2, I propose that we make $UserID mandatory and create/throw an Exception if $UserID is null.


Reply to this email directly or view it on GitHub.

@jburns131
Copy link
Collaborator Author

This method's intent/purpose is to return roles assigned to a user.

I have one concern regarding returning an object for this method. In either case we will be returning data for multiple items (every roll assigned to a user). I think we should probably stick with the array, because if we return an object it will still contain multiple items and in essence still be a multidimensional array.

I think if we were to return a single entity then an object would be ideal, but I'm not too sure about multiple entities. That sounds like the job and purpose of an array.

Let me know what you think.

P.S. Your response sparked an idea. I've created Issue #9 as a proposal.

@abiusx
Copy link
Contributor

abiusx commented Aug 23, 2013

hmm
thats a sound point. lets return arrays, they are easier to convert into objects, but one should definitely know what indexes will be in the array.
-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 Shahrivar 1, 1392, at 1:55 PM, Jesse Burns notifications@github.com wrote:

This method's intent/purpose is to return roles assigned to a user.

I have one concern regarding returning an object for this method. In either case we will be returning data for multiple items (every roll assigned to a user). I think we should probably stick with the array, because if we return an object it will still contain multiple items and in essence still be a multidimensional array.

I think if we were to return a single entity then an object would be ideal, but I'm not too sure about multiple entities. That sounds like the job and purpose of an array.

Let me know what you think.

P.S. Your response sparked an idea. I've created Issue #9 as a proposal.


Reply to this email directly or view it on GitHub.

@jburns131
Copy link
Collaborator Author

Hey, I just realized that I responded to the comment about array's vs objects in the wrong Issue. The issue we should have had this conversation in is Issue #7.

I've added these comments to Issue #7 for future reference.

jburns131 added a commit that referenced this issue Aug 24, 2013
…ge for further details.

Resolves Issue #2:

* I have removed all references of 'jf::CurrentUser()', made $UserID mandatory, and have added an exception if the $UserID is not provided. This exception will add flexibility to PhpRbac's testability and error handling capabilities.
* I have updated all affected Unit Tests associated with these changes, while adding Unit Tests as needed

Resolves Issue #3:

* Along with the changes from Issue #2, I have removed the references to jb::run and added the 403 header along with a die which displays a 'Forbidden' message if the check in $rbac->enforce fails
* If the check in $rbac->enforce is successful, $rbac->enforce will return true for testing and error handling purposes

Resolves #6:

* UserID is now mandatory and will throw an exception if the parameter is empty
@jburns131
Copy link
Collaborator Author

I've addressed this Issue in commit aebafee

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants