? ? Success

User tests: Successful: Unsuccessful:

avatar infograf768
infograf768
10 Jun 2016

Pull Request for Issue #10775

Create a subgroup of administrator
for example "testgroup"
Deny some permissions for that group, for example Create, Edit, etc. (anything for the sake of the demonstration) globally or for any component except com_users.
Log with a user member of the "testgroup"
Go to User Manager, edit the user, change his group to Administrator.
Before patch this is possible.

Patch and test again: the Assigned User Groups tab does not display anymore.
screen shot 2016-06-10 at 12 39 34

avatar infograf768 infograf768 - open - 10 Jun 2016
avatar infograf768 infograf768 - change - 10 Jun 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 10 Jun 2016
Labels Added: ?
avatar brianteeman brianteeman - change - 10 Jun 2016
Category ACL
avatar bertmert bertmert - test_item - 10 Jun 2016 - Tested successfully
avatar bertmert
bertmert - comment - 10 Jun 2016

I have tested this item successfully on 3ec40bf


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10776.

avatar infograf768 infograf768 - change - 10 Jun 2016
The description was changed
avatar andrepereiradasilva andrepereiradasilva - test_item - 10 Jun 2016 - Tested successfully
avatar andrepereiradasilva
andrepereiradasilva - comment - 10 Jun 2016

I have tested this item successfully on 3ec40bf

works as described.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10776.

avatar brianteeman brianteeman - change - 10 Jun 2016
Status Pending Ready to Commit
avatar brianteeman
brianteeman - comment - 10 Jun 2016

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10776.

avatar joomla-cms-bot joomla-cms-bot - change - 10 Jun 2016
Labels Added: ?
avatar infograf768
infograf768 - comment - 11 Jun 2016

This is an admin template and not a site template.
But thanks. I had forgotten to modify Hathor too. Doing now.
There is no reason for a Super User to change its group and he should not anyway.

avatar joomla-cms-bot
joomla-cms-bot - comment - 11 Jun 2016

This PR has received new commits.

CC: @andrepereiradasilva, @bertmert


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10776.

avatar infograf768
infograf768 - comment - 11 Jun 2016

We could indeed also simplify by adding the code in view.html.php, which would prevent adding it in both admin templates.

        if ((int) JFactory::getUser()->id == (int) $this->item->id)
        {
            $this->grouplist = null;
        }

Not a big deal imho...

avatar izharaazmi
izharaazmi - comment - 11 Jun 2016

We could indeed also simplify by adding the code in view.html.php, which would prevent adding it in both admin templates.

Correct, that's is what I meant ????

avatar izharaazmi
izharaazmi - comment - 11 Jun 2016

Or better, call model only when needed.

if ((int) JFactory::getUser()->id != (int) $this->item->id)
{
    $this->grouplist = $this->get('Groups');
}
avatar joomla-cms-bot
joomla-cms-bot - comment - 11 Jun 2016

This PR has received new commits.

CC: @andrepereiradasilva, @bertmert


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10776.

avatar infograf768
infograf768 - comment - 11 Jun 2016

Done, please test and set test as success ful in https://issues.joomla.org/tracker/joomla-cms/10776

We need this in 3.6.0. Thanks

avatar infograf768
infograf768 - comment - 11 Jun 2016

Can the milestone be added to 3.6.0 please?
@wilsonge @brianteeman

avatar izharaazmi
izharaazmi - comment - 11 Jun 2016

@infograf768 You need to remove line 42. Without it the grouplist is anyway already populated.

avatar joomla-cms-bot
joomla-cms-bot - comment - 11 Jun 2016

This PR has received new commits.

CC: @andrepereiradasilva, @bertmert


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10776.

avatar infograf768
infograf768 - comment - 11 Jun 2016

done. It was working here though. Maybe a session issue

avatar izharaazmi
izharaazmi - comment - 11 Jun 2016

@infograf768 Accept my apologies for coming in small bits.
I just noticed $this->groups = $this->get('AssignedGroups'); at now line 42 (43 previously) is unused when not editing groups. Would you please move that too inside the recently added if conditional!

avatar infograf768
infograf768 - comment - 11 Jun 2016

I should have stayed with the simple ones I had at the beginning.. :)
No time now.

avatar izharaazmi izharaazmi - test_item - 11 Jun 2016 - Tested successfully
avatar izharaazmi
izharaazmi - comment - 11 Jun 2016

I have tested this item successfully on d08924b
Thanks!


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10776.

avatar andrepereiradasilva andrepereiradasilva - test_item - 11 Jun 2016 - Tested successfully
avatar andrepereiradasilva
andrepereiradasilva - comment - 11 Jun 2016

I have tested this item successfully on d08924b


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10776.

avatar ggppdk ggppdk - test_item - 11 Jun 2016 - Tested unsuccessfully
avatar ggppdk
ggppdk - comment - 11 Jun 2016

I have tested this item ???? unsuccessfully on d08924b

I have applied the patch,

  1. logged as "Administrator"
  2. then editted the DOM to copy-paste the usergroups form fields from another form
  3. modified the user-groups, and then clicking save has saved the usergroups
    This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10776.
avatar ggppdk
ggppdk - comment - 11 Jun 2016

At the top of the save() method
https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/user/user.php#L706

I have tested the following code (and seems to solve the issue with server-side validation of enforcing the new policy):

    // Enforce security policy, user can not modify its own user-groups
    if ( $this->id == JFactory::getUser()->id )
    {
        if ($this->groups != null)
        {
            // Form was probably tampered with
            JFactory::getApplication()->enqueueMessage(
                'You can not edit your own user groups, usergroups saving was skipped',
                'warning'
            );
            $this->groups = null;
        }
    }
avatar izharaazmi
izharaazmi - comment - 11 Jun 2016

Nice catch. The save method in the model must also be taken care of to
ignore/warn about $data['group']

On 12-Jun-2016 2:48 AM, "Georgios Papadakis" notifications@github.com
wrote:

I have tested this item ? unsuccessfully on d08924b
d08924b

I have applied the patch,

  1. logged as "Administrator"
  2. then editted the DOM to copy-paste the usergroups form fields from another form
  3. modified the user-groups, and then clicking save has saved the usergroups ------------------------------ This comment was created with the J!Tracker Application https://github.com/joomla/jissues at issues.joomla.org/joomla-cms/10776 https://issues.joomla.org/tracker/joomla-cms/10776.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#10776 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AGZUDS4s_wP927AXkgD7c9dd72GvUSNfks5qKyZAgaJpZM4Iy1Pp
.

avatar infograf768
infograf768 - comment - 13 Jun 2016

@ggppdk

Can you propose a patch against my branch? With a new lang string if necessary.

avatar joomla-cms-bot
joomla-cms-bot - comment - 14 Jun 2016

This PR has received new commits.

CC: @andrepereiradasilva, @bertmert, @ggppdk, @izharaazmi


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10776.

avatar joomla-cms-bot joomla-cms-bot - change - 14 Jun 2016
Labels Added: ?
avatar infograf768
infograf768 - comment - 14 Jun 2016

Folks, I have implemented the check in model. Is'nt that sufficient? Do we really need to also add it to the library?

avatar izharaazmi
izharaazmi - comment - 14 Jun 2016

I think it would not be appropriate to enforce this in the library. Checks
in the model should be enough here.

I am assuming the case when certain component such as subscription will try
to manipulate the usergroups of the current user when they purchase a plan,
it would be a trouble.

avatar infograf768
infograf768 - comment - 14 Jun 2016

OK, therefore please set test as successful (after testing ? )

avatar ggppdk
ggppdk - comment - 14 Jun 2016

@izharaazmi @infograf768

i was about to comment on the same thing,

  • i am wondering if the library or the model is best place to add this check

and thinking if it is good to enforce this on 3rd party,

now after the comment of @izharaazmi, i see that indeed it is better to add it to the model

avatar infograf768
infograf768 - comment - 14 Jun 2016

@izharaazmi @ggppdk
Please test and mark your test on https://issues.joomla.org/tracker/joomla-cms/10776
We need this in 3.6.0
Thanks

avatar ggppdk
ggppdk - comment - 14 Jun 2016

I have tested

  • editing different user, all good
  • editing self without form tampering to inject groups, all good
  • editing self with form tampered to inject groups, all good, we get warning + form is saved without changing the groups

but before marking this successful, a question

what about a super admin ? should a super admin be allowed to change its own groups ?

  • currently the form and the model will not allow a super admin user to change its own groups

[EDIT]
i know it was mentioned above, but a super admin may want to add its account to a group ? (i think)

avatar infograf768
infograf768 - comment - 14 Jun 2016

As SuperAdmin (as defined in Global Configuration) has all permissions, he is afaik de facto member of all groups.

avatar infograf768
infograf768 - comment - 14 Jun 2016

SuperAdmin => Super User

avatar izharaazmi
izharaazmi - comment - 14 Jun 2016

Not necessary, but if you want you can also exempt super users from this enforcement to make things obvious.

avatar infograf768
infograf768 - comment - 14 Jun 2016

Not necessary, but if you want you can also exempt super users from this enforcement to make things obvious.

No use imho.

avatar izharaazmi
izharaazmi - comment - 14 Jun 2016

I see it would be necessary to exempt the Super User from this rule OR remove the checks at line 231, starting with

if ($iAmSuperAdmin && $my->get('id') == $pk)
...

It is anyway useless to check self demote enforcement (but keep the comment note) when we never allow group change.

Test this patch for super user and you'll see it failing.

avatar infograf768
infograf768 - comment - 14 Jun 2016

Indeed, it is failing when superuser wants to modify himself
I get the warning
"Save failed with the following error: You can't remove your own Super User permissions."

avatar izharaazmi
izharaazmi - comment - 14 Jun 2016

I think the simple and yet reliable way would be to change

if ($iAmSuperAdmin && $my->get('id') == $pk)

to

if (isset($data['groups']) && $iAmSuperAdmin && $my->get('id') == $pk)
avatar joomla-cms-bot
joomla-cms-bot - comment - 14 Jun 2016

This PR has received new commits.

CC: @andrepereiradasilva, @bertmert, @ggppdk, @izharaazmi


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10776.

avatar infograf768
infograf768 - comment - 14 Jun 2016

I used another way. Please test.

avatar izharaazmi
izharaazmi - comment - 14 Jun 2016

Great! You exempted the Super user. I'll now set my test success in few minutes. ?

avatar izharaazmi
izharaazmi - comment - 14 Jun 2016

One thing which is not related to this PR anyway.

Have you tried removing a user from ALL user groups? It doesn't update. Because $data['groups'] is not set in that case. What do you suggest?

avatar joomla-cms-bot
joomla-cms-bot - comment - 14 Jun 2016

This PR has received new commits.

CC: @andrepereiradasilva, @bertmert, @ggppdk, @izharaazmi


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10776.

avatar izharaazmi izharaazmi - test_item - 14 Jun 2016 - Tested successfully
avatar izharaazmi
izharaazmi - comment - 14 Jun 2016

I have tested this item successfully on a3a9afa

1. Without any hacks for each registered and administrator (normal) users - does not allow saving own groups, allows for other than own.
2. With DOM manipulation to force submit user groups for normal users - shows warning and groups not changed for own, allowed for others.
3. For Super user allows all groups changes. Also warns when user tries to remove own super user rights (everything same as without this patch)
4. Non super user cannot edit super user (less relevant, but important)

?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10776.

avatar izharaazmi
izharaazmi - comment - 14 Jun 2016

That you said about J3.6 aiming, can you please have a look at #10657 too!

avatar infograf768
infograf768 - comment - 14 Jun 2016

Have you tried removing a user from ALL user groups? It doesn't update. Because $data['groups'] is not set in that case. What do you suggest?

Indeed unrelated. We should imho in that case display a message telling that a user should be assigned to at least one user group.
Further test show that one could create a new user without any user group... In that case when the user tries to login he is treated as Public/Guest when trying to login in frontend.
Both these situations should be taken care of I guess. Best would be to discuss first this on list.

avatar ggppdk ggppdk - test_item - 14 Jun 2016 - Tested successfully
avatar ggppdk
ggppdk - comment - 14 Jun 2016

I have tested this item successfully on a3a9afa

Thanks for the super admin update

  • various software, including mine use use-groups assignments not only for ACL

e.g. they use them to select users to which to send notifications

thus super users should be able to edit their own user-groups and assign them-selves to such user-goups

  • Works when editing other user
  • Works when editing self, (user-groups do not appear)
  • Works when editing self, with DOM manipulation to inject the groups, form is saved without user-groups being changed
  • Works for super users, when editing self, they can modify the usergroups
    This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10776.
avatar zero-24
zero-24 - comment - 14 Jun 2016

RTC based on testing.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10776.

avatar wilsonge wilsonge - change - 15 Jun 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-06-15 23:12:27
Closed_By wilsonge
avatar wilsonge wilsonge - reference | da79cb0 - 15 Jun 16
avatar wilsonge wilsonge - merge - 15 Jun 2016
avatar wilsonge wilsonge - close - 15 Jun 2016
avatar wilsonge wilsonge - change - 15 Jun 2016
Milestone Added:
avatar wojsmol
wojsmol - comment - 15 Jun 2016

@joomla-cms-bot Please remove RTC label as this is merged.

avatar joomla-cms-bot joomla-cms-bot - change - 15 Jun 2016
Labels Removed: ?
avatar wilsonge
wilsonge - comment - 15 Jun 2016

Thanks for the work on this everyone!

avatar Devportobello
Devportobello - comment - 17 May 2018

Why not adding a new permission to grant access ? by checking only "core.admin" this introduce B/C

avatar zero-24
zero-24 - comment - 17 May 2018

This is a issue closed on 16 Jun 2016 please open a new issue as this message is going to be missed.

Add a Comment

Login with GitHub to post a comment