Issue #3439833: Remove $usesSuperUserAccessPolicy Varibale.
Closes #3439833
Merge request reports
Activity
added 409 commits
-
80dfc73d...cc9baee9 - 408 commits from branch
project:11.x
- a4dacf0a - Issue #3439833: Remove $usesSuperUserAccessPolicy Varibale.
-
80dfc73d...cc9baee9 - 408 commits from branch
added 1 commit
- 7e973567 - issue/3439833: Added perms ContentTranslationEnableTest
added 1 commit
- e49e619a - issue/3439833 : Updated ContentTranslationEnableTest
added 1 commit
- 382735f7 - issue/3439833: added perms ContentTranslationPendingRevisionTestBase to remove...
added 1 commit
- 8ac444dc - issue/3439833: Added perms ContentTranslationUntranslatableFieldsTest &...
added 1 commit
- 42c72831 - issue/3439833: Added perms ContentTranslationOutdatedRevisionTranslationTest &...
added 1 commit
- 48d0512f - issue/3439833: Added perms ContentTranslationRevisionTranslationDeletionTest &...
55 58 $this->drupalGet('admin/reports/status'); 56 59 $this->assertSession()->elementTextEquals('css', "details.system-status-report__entry summary:contains('Entity/field definitions') + div", 'Up to date'); 57 60 61 $all_rids = $web_user->getRoles(); I have verified Permission can be assign: if module installed before user login, here we can see at line no. 42-47 module install, in this scenario way to assign permission by creating role with respective perms (tried to check in the core test files also).
Edited by Pooja SharmaI agree goal of ticket is adding permissions only, however permission can be assign to user only if module install code added before user login, if module install (can notice at line no. 42-47) & respective config install (if required/added) code added after user login code in that case scenario permission can be assign only by adding role (checked in core as well)
Edited by Pooja Sharmachanged this line in version 14 of the diff
169 171 // Enable content moderation and verify that widgets are hidden despite them 170 172 // being configured to be displayed. 171 173 $this->enableContentModeration(); 174 $this->drupalLogin($this->administrator); I checked in this enableContentModeration() here user login with specific user code added. when user comes back out of this func, user logout , due to which user login code needs to add. I believe earlier superuser code exist that always keep user login due to which this code never needs to add before.
Edited by Pooja Sharmachanged this line in version 16 of the diff
added 1 commit
- 493ed840 - issue/3439833: Updated minimum perms ContentTranslationEnableTest
added 1 commit
- 58089444 - issue/3439833: Updated minimum perms ContentTranslationOutdatedRevisionTranslationTest
added 1 commit
- f479e6cd - issue/3439833: Updated minimum perms ContentTranslationUntranslatableFieldsTest
added 1 commit
- 1ddd01e1 - issue/3439833: Updated minimum perms ContentTranslationRevisionTranslationDeletionTest
added 1 commit
- daf8ec33 - issue/3439833: Apply 1 suggestion(s) to 1 file(s)
added 1 commit
- 4da53101 - issue/3439833: Updated ContentTranslationEnableTest
46 43 ]; 47 44 $this->drupalGet('admin/modules'); 48 45 $this->submitForm($edit, 'Install'); 46 $this->rebuildContainer(); 47 48 $web_user->addRole($this->drupalCreateRole([ 49 'administer content translation', 50 'administer languages', 51 ]))->save(); - Comment on lines +46 to +51
Added API() to add perms, but there needs to be
rebuidContainer()
otherwise invalid perms error displayeven I tried to debug like:
\Drupal::service('user.permissions')->getPermissions();
before using rebuildContainer() but did not able to see perms but after adding it , using again getPermissions() can able to see perms & also able to assign to the user.used drupalCreateRole() for assign perms, as it use current user object, but in
grantPermissions()
role need to pass like this :$this->grantPermissions(Role::load(Role::AUTHENTICATED_ID), [ 'administer content translation', 'administer languages', ]);
Edited by Pooja Sharma I believe may be something is missing from my end, however Checked in core files, there are two ways to assign the perms for logged in user one is by addRole() & other is getPermissions() in both we pass perms that are available after module install. (if module install code added after user login)
should I use grantPermissions()?
Edited by Pooja Sharmachanged this line in version 16 of the diff
52 44 } 53 45 } 54 46 47 /** 48 * {@inheritdoc} 49 */ 50 protected function getEditorPermissions(): array { 51 return array_merge(parent::getEditorPermissions(), [ 52 "view latest version", 53 ]); 54 } 55 - Comment on lines +52 to +55
Override it & added this specific function "view latest version" as this perms required to access revision page w.r.t. suggested approach.
If not include this code , then test not break but when I compare page output of this test page (page no. 24 generated by test) with old test (with superuser code added) then this page not accessible.
Edited by Pooja Sharma Very nice to test so thoroughly. I did the same with and without the diff applied. The results for this tests are different, unfortunately. The original test has 22 pages that have the text 'Access denied' while this new version has 6. The new version should have the same output as the original.
changed this line in version 17 of the diff
@pooja_sharma, thanks for changing this so quickly. I adjusted my command to print the number of files with 'access denied'. I then retested and get the same pages with 'access denied' with and with the MR. And they are same pages reported above.
So this is fixed, thanks