d39f65b15ff01c0d08804ff0e59715967ee2c113,controllers/admin.py,,user,#,55

Before Change


        // Needed as Admin has all roles
        pe_ids = None
    elif s3_has_role("ORG_ADMIN"):
        if settings.get_security_policy() < 6:
            // Filter users to just those belonging to the Org Admin"s Org & Descendants
            otable = s3db.org_organisation
            pe_id = db(otable.id == auth.user.organisation_id).select(otable.pe_id,
                                                                      limitby=(0, 1),
                                                                      cache=s3db.cache,
                                                                      ).first().pe_id
            pe_ids = s3db.pr_get_descendants(pe_id, entity_types="org_organisation")
            pe_ids.append(pe_id)
            s3.filter = (otable.pe_id.belongs(pe_ids)) & \
                        (table.organisation_id == otable.id)
        else:
            // Filter users to just those belonging to the Org Admin"s Realms
            pe_ids = auth.user.realms[auth.get_system_roles().ORG_ADMIN]
            if pe_ids:
                otable = s3db.org_organisation
                s3.filter = (otable.pe_id.belongs(pe_ids)) & \
                            (table.organisation_id == otable.id)
    else:
        auth.permission.fail()

    auth.configure_user_fields(pe_ids)

After Change



    elif s3_has_role(sr.ORG_ADMIN):
        pe_ids = auth.get_managed_orgs()
        if pe_ids is None:
            // OrgAdmin with default realm, but user not affiliated with any org
            auth.permission.fail()
        elif pe_ids is not True:
            // OrgAdmin for certain organisations
            otable = s3db.org_organisation
            s3.filter = (otable.pe_id.belongs(pe_ids)) & \
                        (table.organisation_id == otable.id)
        else:
            // OrgAdmin with site-wide permission
            pe_ids = None
    else:
        auth.permission.fail()

    auth.configure_user_fields(pe_ids)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: sahana/eden
Commit Name: d39f65b15ff01c0d08804ff0e59715967ee2c113
Time: 2018-10-11
Author: dominic@nursix.org
File Name: controllers/admin.py
Class Name:
Method Name: user


Project Name: sahana/eden
Commit Name: 3ae77833389609a2c958c745e47086ece9efef73
Time: 2020-03-30
Author: fran@aidiq.com
File Name: modules/s3/s3gis.py
Class Name: GIS
Method Name: set_config


Project Name: OpenMined/Grid
Commit Name: 83d8d58b3867b251c1441fc29c7b719036b14f67
Time: 2021-03-30
Author: ionesiojr@gmail.com
File Name: apps/domain/src/main/core/services/request_service.py
Class Name:
Method Name: update_request_msg