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 32
    • Merge Requests 32
  • 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
  • !350

Open
Opened 5 days ago by Brian Hatchet@brianhatchet:speech_balloon:
  • Report abuse
Report abuse

WIP: Epic/permissions 28

MR for insight into everything that has changed for permissions

Check out, review, and merge locally

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

git fetch origin
git checkout -b "epic/permissions-28" "origin/epic/permissions-28"

Step 2. Review the changes locally

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

git fetch origin
git checkout "origin/master"
git merge --no-ff "epic/permissions-28"

Step 4. Push the result of the merge to GitLab

git push origin "master"

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 epic/permissions-28 into master
The source branch is 7 commits behind the target branch
Open in Web IDE
  • Email patches
  • Plain diff
Pipeline #87118857 failed for d1b2d7a4 on epic/permissions-28
          Requires 3 more approvals from Devs, Deployers, and QA.
          Ben Hayward
          Ben Hayward
          Marcelo Rivera
          Marcelo Rivera
          Emiliano Balbuena
          Emiliano Balbuena
          Rami Albatal
          Rami Albatal
          Mark Harding
          Mark Harding
          There are merge conflicts. Resolve these conflicts or ask someone with write access to this repository to merge it locally

          Deletes source branch

          You can merge this merge request manually using the
          • Discussion 10
          • Commits 15
          • Pipelines 10
          • Changes 66
          0/10 threads resolved
          • Loading...
          • Brian Hatchet :speech_balloon: @brianhatchet changed milestone to %Permission #review 5 days ago

            changed milestone to %Permission #review

          • Brian Hatchet :speech_balloon: @brianhatchet added Sprint::09/25 - Oldfashioned Owl Squad::Green scoped labels 5 days ago

            added Sprint::09/25 - Oldfashioned Owl Squad::Green scoped labels

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

            added 2 commits

            • 21171789 - Chore refactor permissions export
            • 1559425f - Merge branch 'chore-refactor-permissions-export' into 'epic/permissions-28'

            Compare with previous version

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

            added 1 commit

            • 8c974984 - Merge

            Compare with previous version

          • Mark Harding @markeharding mentioned in epic &28 4 days ago

            mentioned in epic &28

          • Marcelo Rivera @eiennohi added 1 commit 4 days ago

            added 1 commit

            • 0c4046d6 - (fix): don't do strict checks on guids

            Compare with previous version

          • Marcelo Rivera @eiennohi added 2 commits 20 hours ago

            added 2 commits

            • c9f0865f - (fix): assign $entities after checking user entity
            • d1b2d7a4 - (feat): more thorough spec tests

            Compare with previous version

          • Mark Harding @markeharding added MR::Requires Changes scoped label 41 minutes ago

            added MR::Requires Changes scoped label

          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 32 minutes ago
            Api/Exportable.php
            108 if ($item && Di::_()->get('Features\Manager')->has('permissions')) {
            109 if ($item instanceof FeedSyncEntity && $item->getEntity()) {
            110 $entity = $item->getEntity();
            111 } else {
            112 $entity = $item;
            113 }
            114
            115 /** @var Manager $permissionsManager */
            116 $permissionsManager = Di::_()->get('Permissions\Manager');
            117 $permissions = $permissionsManager->getList([
            118 'user_guid' => Session::getLoggedinUser(),
            119 'entities' => [$entity],
            120 ]);
            121
            122 if ($item instanceof FeedSyncEntity) {
            123 $exported['entity']['permissions'] = $permissions->exportPermission($entity->getGuid());
            • Mark Harding
              Mark Harding @markeharding · 32 minutes ago
              Owner

              Why are we calling this exportPermission() and not just export()?

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 32 minutes ago
            Api/Exportable.php
            100 105
            101 106 $exported = $item->export(...$this->exportArgs);
            102 107
            108 if ($item && Di::_()->get('Features\Manager')->has('permissions')) {
            109 if ($item instanceof FeedSyncEntity && $item->getEntity()) {
            110 $entity = $item->getEntity();
            111 } else {
            112 $entity = $item;
            113 }
            114
            115 /** @var Manager $permissionsManager */
            116 $permissionsManager = Di::_()->get('Permissions\Manager');
            117 $permissions = $permissionsManager->getList([
            • Mark Harding
              Mark Harding @markeharding · 32 minutes ago
              Owner

              Why are using a list function for a single entity?

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 32 minutes ago
            Api/Factory.php
            220 $entities[$k]['guid'] = (string) $entities[$k]['guid']; //javascript doesn't like long numbers..
            221 if (isset($entities[$k]['ownerObj']['guid'])) {
            222 $entities[$k]['ownerObj']['guid'] = (string) $entity->ownerObj['guid'];
            223 }
            224 foreach ($exceptions as $exception) {
            225 $entities[$k][$exception] = $entity->$exception;
            226 }
            215 $entities[$k] = Factory::export($entity, $exceptions, $exportContext, $includePermissions);
            227 216 }
            228 217 return $entities;
            229 218 }
            219
            220 /**
            221 * Exports a single entity, called by exportable for arrays
            222 */
            223 public static function export($entity, $exceptions = false, $exportContext=false, $includePermissions = true)
            • Mark Harding
              Mark Harding @markeharding · 32 minutes ago
              Owner

              Theres now a lot going on the API factory that I think warrants a refactor from statics to objects.

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 32 minutes ago
            Core/Feeds/FeedSyncEntity.php
            36 41 /** @var int */
            37 42 protected $timestamp;
            38 43
            44 /** @var int */
            45 protected $accessId;
            46
            39 47 /** @var string */
            40 48 protected $urn;
            41 49
            42 50 /** @var Entity */
            43 51 protected $entity;
            44 52
            53 public function setEntity($entity)
            • Mark Harding
              Mark Harding @markeharding · 32 minutes ago
              Owner

              Code doc and type needed

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 32 minutes ago
            Core/Feeds/FeedSyncEntity.php
            50 69 {
            51 70 return [
            52 71 'guid' => (string) $this->guid,
            53 'owner_guid' => (string) $this->ownerGuid,
            72 'owner_guid' => (string) $this->ownerGuid,
            73 'access_id' => $this->accessId,
            • Mark Harding
              Mark Harding @markeharding · 32 minutes ago
              Owner

              force as int?

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 32 minutes ago
            Core/Permissions/Permissions.php
            37 public function __construct(User $user = null, Roles $roles = null, EntitiesBuilder $entitiesBuilder = null)
            38 38 {
            39 39 $this->entitiesBuilder = $entitiesBuilder ?: Di::_()->get('EntitiesBuilder');
            40 40 $this->roles = $roles ?: new Roles();
            41 41 $this->user = $user;
            42 $this->isAdmin = $user->isAdmin();
            43 $this->isBanned = $user->isBanned();
            44 42 $this->groups = [];
            45 43 $this->channels = [];
            46 44 $this->entities = [];
            45 $this->roles = $roles ?: new Roles();
            46 $this->user = $user;
            47 if ($this->user) {
            48 $this->isAdmin = $user->isAdmin();
            49 $this->isBanned = $user->isBanned();
            50 $this->channels[$user->getGuid()] = $user;
            • Mark Harding
              Mark Harding @markeharding · 32 minutes ago
              Owner

              where is $channels var instantiated?

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 32 minutes ago
            Core/Permissions/Permissions.php
            72 77 public function calculate(array $entities = []): void
            73 78 {
            74 79 foreach ($entities as $entity) {
            75 $this->entities[$entity->getGUID()] = $this->getRoleForEntity($entity);
            80 if ($entity) {
            81 $this->entities[$entity->getGuid()] = $this->getRoleForEntity($entity);
            82 }
            76 83 }
            77 84 }
            78 85
            79 86 private function getRoleForEntity($entity): Role
            • Mark Harding
              Mark Harding @markeharding · 32 minutes ago
              Owner

              code doc needed

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 32 minutes ago
            Core/Permissions/Permissions.php
            119 150 return $export;
            120 151 }
            121 152
            153 /**
            154 * Export the exact permissions for a calculated entity only
            155 *
            156 * @return array serialized individual permission for an entity
            157 */
            158 public function exportPermission($guid): array
            • Mark Harding
              Mark Harding @markeharding · 32 minutes ago
              Owner

              I'm having trouble with this function name, its not clear how it is different from export() function.

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 32 minutes ago
            Core/Provisioner/Provisioners/cassandra-provision.cql
            1446 1446 PRIMARY KEY (receiver_guid, time_sent)
            1447 1447 ) WITH CLUSTERING ORDER BY (time_sent desc);
            1448 1448
            1449 CREATE TABLE minds.moderation_reports (
            • Mark Harding
              Mark Harding @markeharding · 32 minutes ago
              Owner

              Do we want this in this MR?

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 32 minutes ago
            classes/ElggEntity.php
            21 21 * @property-read string $enabled
            22 22 */
            23 23 abstract class ElggEntity extends ElggData implements
            24 Importable // Allow import of data
            • Mark Harding
              Mark Harding @markeharding · 32 minutes ago
              Owner

              I can't tell what has been changed in this file.

            • 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
          Permission #review
          Milestone
          Permission #review
          Assign milestone
          None
          Time tracking
          No estimate or time spent
          3
          Labels
          MR::Requires Changes Sprint::09/25 - Oldfashioned Owl Squad::Green
          Assign labels
          • View project labels
          Lock merge request
          Unlocked
          10
          10 participants
          user avatar
          Ben Hayward
          user avatar
          Marcelo Rivera
          user avatar
          Emiliano Balbuena
          user avatar
          Rami Albatal
          user avatar
          Mark Harding
          user avatar
          Martin Santangelo
          user avatar
          Guy Thouret
          Reference: minds/engine!350