Skip to content

Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
Minds Backend - Engine
Minds Backend - Engine
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
    • Insights
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
    • Locked Files
  • Issues 222
    • Issues 222
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 37
    • Merge Requests 37
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Security & Compliance
    • Security & Compliance
    • Dependency List
  • Packages
    • Packages
    • List
    • Container Registry
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Minds
  • Minds Backend - EngineMinds Backend - Engine
  • Merge Requests
  • !335

Open
Opened 1 week ago by Brian Hatchet@brianhatchet:speech_balloon:
  • Report abuse
Report abuse

WIP: (WIP) Feat/permissions on entities 737

Edited 3 days ago by Brian Hatchet

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b "feat/permissions-on-entities-737" "origin/feat/permissions-on-entities-737"

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git fetch origin
git checkout "origin/epic/permissions-28"
git merge --no-ff "feat/permissions-on-entities-737"

Step 4. Push the result of the merge to GitLab

git push origin "epic/permissions-28"

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

Request to merge feat/permissions-on-entities-737 into epic/permissions-28
Open in Web IDE
  • Email patches
  • Plain diff
Pipeline #85496046 passed for 9c3c4a85 on feat/permissions-on-entities-737
          Requires 2 more approvals from Devs and Deployers.
          Mark Harding
          Mark Harding
          Rami Albatal
          Rami Albatal
          Ben Hayward
          Ben Hayward
          Martin Santangelo
          Martin Santangelo
          Emiliano Balbuena
          Emiliano Balbuena
          This is a Work in Progress

          Deletes source branch

          You can merge this merge request manually using the
          • Discussion 15
          • Commits 40
          • Pipelines 21
          • Changes 57
          0/15 threads resolved
          • Loading...
          • Brian Hatchet :speech_balloon: @brianhatchet added Sprint::09/11 - Nuanced Numbat Squad::Green scoped labels 1 week ago

            added Sprint::09/11 - Nuanced Numbat Squad::Green scoped labels

          • Brian Hatchet :speech_balloon: @brianhatchet added 1 commit 1 week ago

            added 1 commit

            • a0695d01 - Testing banned role

            Compare with previous version

          • Brian Hatchet :speech_balloon: @brianhatchet added 1 commit 1 week ago

            added 1 commit

            • 2f1aee28 - Open and closed group permissions

            Compare with previous version

          • Brian Hatchet :speech_balloon: @brianhatchet added 1 commit 1 week ago

            added 1 commit

            • a110fc61 - More permissions

            Compare with previous version

          • Brian Hatchet :speech_balloon: @brianhatchet added 1 commit 1 week ago

            added 1 commit

            • dfc4f306 - Moderated channel permissions

            Compare with previous version

          • Brian Hatchet :speech_balloon: @brianhatchet added 1 commit 6 days ago

            added 1 commit

            • 01a69464 - All the permissions* (minus all the things I forgot/don't now about)

            Compare with previous version

          • Brian Hatchet :speech_balloon: @brianhatchet unmarked as a Work In Progress 6 days ago

            unmarked as a Work In Progress

          • Brian Hatchet :speech_balloon: @brianhatchet changed target branch from master to epic/permissions-28 6 days ago

            changed target branch from master to epic/permissions-28

          • Brian Hatchet :speech_balloon: @brianhatchet added 1 commit 6 days ago

            added 1 commit

            • 8308fd1d - Yeah for unit tests

            Compare with previous version

          • Brian Hatchet :speech_balloon: @brianhatchet added 2 commits 6 days ago

            added 2 commits

            • 72c7048d - (feat): record referral cookie on channel and asset pages
            • a422be04 - Merge remote-tracking branch 'origin/master' into feat/permissions-on-entities-737

            Compare with previous version

          • Brian Hatchet :speech_balloon: @brianhatchet added 1 commit 5 days ago

            added 1 commit

            • 81b20c54 - Merge fix

            Compare with previous version

          • Brian Hatchet :speech_balloon: @brianhatchet added 1 commit 5 days ago

            added 1 commit

            • 2659fb93 - Fixing rate limit unit test that was time dependent

            Compare with previous version

          • Brian Hatchet :speech_balloon: @brianhatchet added 1 commit 5 days ago

            added 1 commit

            • fe2dc343 - Refactoring flags out into their own class so we can iterate over the...

            Compare with previous version

          • Brian Hatchet :speech_balloon: @brianhatchet added 1 commit 4 days ago

            added 1 commit

            • 9e615349 - Helpers/flags is now trying to check the type property on FeedSyncEntity. Need...

            Compare with previous version

          • Emiliano Balbuena @edgebal approved this merge request 4 days ago

            approved this merge request

          • Marcelo Rivera @eiennohi approved this merge request 4 days ago

            approved this merge request

          • Marcelo Rivera @eiennohi unapproved this merge request 4 days ago

            unapproved this merge request

          • Brian Hatchet :speech_balloon: @brianhatchet added 9 commits 3 days ago

            added 9 commits

            • 9e615349...26e56438 - 7 commits from branch epic/permissions-28
            • 8ab258df - Merge remote-tracking branch 'origin/master' into feat/permissions-on-entities-737
            • 40bd92e8 - Unit tests for Manager

            Compare with previous version

          • Brian Hatchet :speech_balloon: @brianhatchet changed title from Feat/permissions on entities 737 to (WIP) Feat/permissions on entities 737 3 days ago

            changed title from Feat/permissions on entities 737 to (WIP) Feat/permissions on entities 737

          • Marcelo Rivera @eiennohi approved this merge request 3 days ago

            approved this merge request

          • Brian Hatchet :speech_balloon: @brianhatchet added 23 commits 2 hours ago

            added 23 commits

            • 95e7b86a - (chore): increase presigned video request to 90 days
            • b0c1432e - (fix): allow video to played if only 50% of transcodes available
            • 400bb77c - Return error if access by unknown user.
            • b69e1e50 - WIP Testing permissions on exports
            • f390f542 - Revert "(chore): increase presigned video request to 90 days"
            • 0028f4c6 - (fix): usa and japan stripe fixes
            • eaaf74d0 - (fix): us customers are required to request capabilities
            • 997ec821 - (feat): support recording multiple entity types
            • 719eb4a4 - Sprint/NuancedNumbat: Null paging token #866 (closed)
            • 1071aa8f - Merge branch 'fix/null-paging-token-866' into 'master'
            • 2ec16e85 - [Sprint/NuancedNumbat] (fix): Logout should provide $session value - Error:...
            • d8446ca6 - Merge branch 'fix/sessions-issue-773' into 'master'
            • 34594d7d - (fix): still respect activity metrics in addition to others
            • 9fec7059 - Sprint/NuancedNumbat: Added in function to return original owner guid #806 (closed)
            • 2203eec7 - Merge branch 'fix/group-report-806' into 'master'
            • a3dfc58d - (chore) Add missing spec tests for new classes; Refactor usage to not use...
            • 65b881df - Merge branch 'chore/616-propogate-props' into 'master'
            • 125e0da2 - (fix): boosts
            • 12fda64d - (chore): september email
            • 8a401b6a - (fix): 2000 not 5000 for email
            • 4f6b8f18 - Merge branch 'fix/null-user-email-setting-872' into 'master'
            • c3608afc - (fix): do not request balance if not user provided
            • 9c3c4a85 - Merge remote-tracking branch 'origin/master' into feat/permissions-on-entities-737

            Compare with previous version

            Toggle commit list
          • Brian Hatchet :speech_balloon: @brianhatchet marked as a Work In Progress from b69e1e50 2 hours ago

            marked as a Work In Progress from b69e1e50

          • Marcelo Rivera
            Marcelo Rivera @eiennohi started a thread on the diff 11 minutes ago
            Api/Exportable.php
            100 103
            101 104 $exported = $item->export(...$this->exportArgs);
            102 105
            106 if ($item && Di::_()->get('Features\Manager')->has('permissions')) {
            107 $userGuid = $user ? $user->getGuid() : null;
            • Marcelo Rivera
              Marcelo Rivera @eiennohi · 11 minutes ago
              Developer

              $user isn't defined here. Maybe add a line before this like: $user = Session::getLoggedInUser(), and also reuse that variable in line 109?

            • Please register or sign in to reply
          • Marcelo Rivera
            Marcelo Rivera @eiennohi started a thread on the diff 11 minutes ago
            Api/Factory.php
            209 209 public static function exportable($entities, $exceptions = [], $exportContext = false)
            210 210 {
            211 $permissionsManager = Di::_()->get('Permissions\Manager');
            211 212 if (!$entities) {
            212 213 return [];
            213 214 }
            215
            214 216 foreach ($entities as $k => $entity) {
            215 217 if ($exportContext && method_exists($entity, 'setExportContext')) {
            216 218 $entity->setExportContext($exportContext);
            217 219 }
            218 220
            219 221 $entities[$k] = $entity->export();
            222 //Calculate new permissions object with the entities
            223 if ($entity && Di::_()->get('Features\Manager')->has('permissions')) {
            224 $userGuid = $user ? $user->getGuid() : null;
            • Marcelo Rivera
              Marcelo Rivera @eiennohi · 11 minutes ago
              Developer

              $user is not defined

            • Please register or sign in to reply
          • Marcelo Rivera
            Marcelo Rivera @eiennohi started a thread on the diff 11 minutes ago
            Controllers/api/v1/channel.php
            91 91
            92 92 $block = Core\Security\ACL\Block::_();
            93 93 $response['channel']['blocked'] = $block->isBlocked($user);
            94
            95 //Calculate new permissions object with the entities
            96 if ($user && Di::_()->get('Features\Manager')->has('permissions')) {
            • Marcelo Rivera
              Marcelo Rivera @eiennohi · 11 minutes ago
              Developer

              do we need this now that we're including permissions on the export itself?

            • Please register or sign in to reply
          • Marcelo Rivera
            Marcelo Rivera @eiennohi started a thread on the diff 11 minutes ago
            Controllers/api/v1/groups.php
            77 77
            78 78 $response['groups'] = Factory::exportable($groups);
            79 79 $response['entities'] = Factory::exportable($groups);
            80
            81 if ($groups && Di::_()->get('Features\Manager')->has('permissions')) {
            • Marcelo Rivera
              Marcelo Rivera @eiennohi · 11 minutes ago
              Developer

              do we need this now that we're including permissions on the export itself?

            • Please register or sign in to reply
          • Marcelo Rivera
            Marcelo Rivera @eiennohi started a thread on the diff 11 minutes ago
            Controllers/api/v1/media.php
            92 92 $response['entity']['canEdit'] = $entity->canEdit();
            93 93 Security\ACL::$ignore = $ignore;
            94 94 }
            95
            96
            95 97 }
            96 98 }
            97 99
            100 $currentUser = Core\Session::getLoggedinUser();
            • Marcelo Rivera
              Marcelo Rivera @eiennohi · 11 minutes ago
              Developer

              do we need this now that we're including permissions on the export itself?

            • Please register or sign in to reply
          • Marcelo Rivera
            Marcelo Rivera @eiennohi started a thread on the diff 11 minutes ago
            Controllers/api/v1/media/recommended.php
            112 112
            113 113 // Trim to correct length
            114 114 $entities = array_slice($entities, 0, $limit);
            115 $permissions = null;
            116 $currentUser = Core\Session::getLoggedinUser();
            • Marcelo Rivera
              Marcelo Rivera @eiennohi · 11 minutes ago
              Developer

              do we need this now that we're including permissions on the export itself?

            • Please register or sign in to reply
          • Marcelo Rivera
            Marcelo Rivera @eiennohi started a thread on the diff 11 minutes ago
            Controllers/api/v1/newsfeed.php
            212 216 }
            213 217 }
            214 218
            219 //Calculate new permissions object with the entities
            220 if ($activity && Di::_()->get('Features\Manager')->has('permissions')) {
            • Marcelo Rivera
              Marcelo Rivera @eiennohi · 11 minutes ago
              Developer

              do we need this now that we're including permissions on the export itself?

            • Please register or sign in to reply
          • Marcelo Rivera
            Marcelo Rivera @eiennohi started a thread on the diff 11 minutes ago
            Controllers/api/v1/newsfeed/single.php
            33 {
            34 $activity = new Activity($pages[1]);
            35
            36 if (!Security\ACL::_()->read($activity)) {
            37 return Factory::response([
            38 'status' => 'error',
            39 'message' => 'You do not have permission to view this post'
            40 ]);
            41 }
            42
            43 if (!$activity->guid || Helpers\Flags::shouldFail($activity)) {
            44 return Factory::response(['status' => 'error']);
            45 }
            46
            47 $response = [
            48 'activtiy' => $activity->export()
            • Marcelo Rivera
              Marcelo Rivera @eiennohi · 11 minutes ago
              Developer

              typo here!

            • Please register or sign in to reply
          • Marcelo Rivera
            Marcelo Rivera @eiennohi started a thread on the diff 11 minutes ago
            Controllers/api/v1/newsfeed/single.php
            37 return Factory::response([
            38 'status' => 'error',
            39 'message' => 'You do not have permission to view this post'
            40 ]);
            41 }
            42
            43 if (!$activity->guid || Helpers\Flags::shouldFail($activity)) {
            44 return Factory::response(['status' => 'error']);
            45 }
            46
            47 $response = [
            48 'activtiy' => $activity->export()
            49 ];
            50
            51 //Calculate new permissions object with the entities
            52 if ($activity && Di::_()->get('Features\Manager')->has('permissions')) {
            • Marcelo Rivera
              Marcelo Rivera @eiennohi · 11 minutes ago
              Developer

              do we need this now that we're including permissions on the export itself?

            • Please register or sign in to reply
          • Marcelo Rivera
            Marcelo Rivera @eiennohi started a thread on the diff 11 minutes ago
            Controllers/api/v2/boost/feed.php
            151 151 ]);
            152 152 }
            153 153
            154 $permissions = null;
            155 //Calculate new permissions object with the entities
            156 if ($boosts && Di::_()->get('Features\Manager')->has('permissions')) {
            • Marcelo Rivera
              Marcelo Rivera @eiennohi · 11 minutes ago
              Developer

              do we need this now that we're including permissions on the export itself?

            • Please register or sign in to reply
          • Marcelo Rivera
            Marcelo Rivera @eiennohi started a thread on the diff 11 minutes ago
            Controllers/api/v2/entities.php
            31 34 ->setUser(Session::getLoggedinUser() ?: null)
            32 35 ->setUrns($urns)
            33 36 ->setOpts([
            34 'asActivities' => $asActivities
            37 'asActivities' => $asActivities,
            35 38 ]);
            36 39
            37 40 $entities = $resolver->fetch();
            38 41
            42 $permissions = null;
            43 //Calculate new permissions object with the entities
            44 if (Di::_()->get('Features\Manager')->has('permissions')) {
            • Marcelo Rivera
              Marcelo Rivera @eiennohi · 11 minutes ago
              Developer

              do we need this now that we're including permissions on the export itself?

            • Please register or sign in to reply
          • Marcelo Rivera
            Marcelo Rivera @eiennohi started a thread on the diff 11 minutes ago
            Controllers/api/v2/feeds.php
            198 196 }
            199 197 }
            200 198
            199 $permissions = null;
            200 //Calculate new permissions object with the entities
            201 if (Di::_()->get('Features\Manager')->has('permissions')) {
            • Marcelo Rivera
              Marcelo Rivera @eiennohi · 11 minutes ago
              Developer

              do we need this now that we're including permissions on the export itself?

            • Please register or sign in to reply
          • Marcelo Rivera
            Marcelo Rivera @eiennohi started a thread on the diff 11 minutes ago
            Controllers/api/v2/feeds/container.php
            157 154 }
            158 155 }
            159 156
            157 $permissions = null;
            158 //Calculate new permissions object with the entities
            159 if (Di::_()->get('Features\Manager')->has('permissions')) {
            • Marcelo Rivera
              Marcelo Rivera @eiennohi · 11 minutes ago
              Developer

              do we need this now that we're including permissions on the export itself?

            • Please register or sign in to reply
          • Marcelo Rivera
            Marcelo Rivera @eiennohi started a thread on the diff 11 minutes ago
            Controllers/api/v2/feeds/subscribed.php
            122 120 }
            123 121 }
            124 122
            123 $permissions = null;
            124 //Calculate new permissions object with the entities
            125 if (Di::_()->get('Features\Manager')->has('permissions')) {
            • Marcelo Rivera
              Marcelo Rivera @eiennohi · 11 minutes ago
              Developer

              do we need this now that we're including permissions on the export itself?

            • Please register or sign in to reply
          • Marcelo Rivera
            Marcelo Rivera @eiennohi started a thread on the diff 11 minutes ago
            Core/Permissions/Permissions.php
            34 34 /** @var EntitiesBuilder */
            35 35 private $entitiesBuilder;
            • Marcelo Rivera
              Marcelo Rivera @eiennohi · 11 minutes ago
              Developer

              we should add

              private $channels;
              private $groups;
            • Please register or sign in to reply
          • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
          Please register or sign in to reply
          Assignee
          Brian Hatchet's avatar
          Brian Hatchet @brianhatchet
          Assign to
          None
          Milestone
          None
          Assign milestone
          None
          Time tracking
          No estimate or time spent
          2
          Labels
          Sprint::09/11 - Nuanced Numbat Squad::Green
          Assign labels
          • View project labels
          Lock merge request
          Unlocked
          7
          7 participants
          user avatar
          Mark Harding
          user avatar
          Rami Albatal
          user avatar
          Ben Hayward
          user avatar
          Martin Santangelo
          user avatar
          Emiliano Balbuena
          user avatar
          Marcelo Rivera
          user avatar
          Brian Hatchet
          Reference: minds/engine!335