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

Only pass user's ID into Users::addRole() #7092

Merged
merged 1 commit into from
Oct 16, 2017
Merged

Only pass user's ID into Users::addRole() #7092

merged 1 commit into from
Oct 16, 2017

Conversation

kioan000
Copy link
Contributor

@kioan000 kioan000 commented Oct 16, 2017

Resolved small bug that occurs when first user is created via app/nut command without Root permissions.
At line 458, addRole() is aimed to accept a user id (int or string), the whole user object as array was passed instead causing a crash at line 234 when userId is used in array_key_exists.
Sorry for IDE autoindent

src/Users.php Outdated
@@ -152,7 +152,7 @@ public function deleteUser($id)
{
$user = $this->getRepository()->find($id);

if (!$user) {
if ( ! $user) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 0 spaces after opening bracket; 1 found

src/Users.php Outdated
@@ -187,18 +187,18 @@ public function getEmptyUser()
*/
public function getUsers()
{
if (!empty($this->users)) {
if ( ! empty($this->users)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 0 spaces after opening bracket; 1 found

src/Users.php Outdated
return $this->users;
}

try {
if (!$tempusers = $this->getRepository()->getUsers()) {
if ( ! $tempusers = $this->getRepository()->getUsers()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 0 spaces after opening bracket; 1 found

src/Users.php Outdated
* @param boolean|integer $enabled
*
* @return integer
*/
public function setEnabled($id, $enabled = true)
{
if (!$user = $this->getUser($id)) {
if ( ! $user = $this->getUser($id)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 0 spaces after opening bracket; 1 found

src/Users.php Outdated
*
* @return boolean
*/
public function hasRole($id, $role)
{
if (!$user = $this->getUser($id)) {
if ( ! $user = $this->getUser($id)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected 0 spaces after opening bracket; 1 found

@GwendolenLynch GwendolenLynch changed the base branch from 3.4 to 3.3 October 16, 2017 15:48
@GwendolenLynch GwendolenLynch changed the title Fixed bug Only pass user's ID into Users::addRole() Oct 16, 2017
@GwendolenLynch
Copy link
Contributor

I've rebased this to 3.3 as it is a valid bug fix 👍

… I also stripped out the IDE changes 😉

@kioan000
Copy link
Contributor Author

Sorry for the messy request :(

@GwendolenLynch
Copy link
Contributor

Meh, mistakes are how we learn in life, and:
image

Oh, and more importantly around here nobody makes mistakes, it was always the sneaky 🐨

@GwendolenLynch GwendolenLynch merged commit 29d8cee into bolt:3.3 Oct 16, 2017
@GwendolenLynch GwendolenLynch added this to the Bolt 3.3 milestone Oct 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants