title: OctoberCMS: How to dynamically filter manage.list in relation configuration file
body: <p>I'm extending the <code>rainlab.user</code> plugin to allow each user to have friends via a simple intermediate table with the following fields:</p>
  
  <pre><code>user_id
  friend_id
  status
  </code></pre>
  
  <p>I've therefor extended the <code>Rainlab.User Controller</code> to have <code>Friends</code> tab where all friends of a user are listed:</p>
  
  <pre><code>use RainLab\User\Models\User as FrontUser;
  use RainLab\User\Controllers\Users as UsersController;
  
  FrontUser::extend(function($model) {
      $model-&gt;belongsToMany['friends']=[
          'RainLab\User\Models\User',
          'table'    =&gt; 'meysam_social_friends',
          'pivot' =&gt; ['status'],
          'key'      =&gt; 'user_id',
          'otherKey' =&gt; 'friend_id'
      ];
  });
  
  UsersController::extend(function($controller) {
      if(!isset($controller-&gt;implement['Backend.Behaviors.RelationController'])) {
          $controller-&gt;implement[] = 'Backend.Behaviors.RelationController';
      }
      $controller-&gt;relationConfig  =  '$/meysam/social/controllers/user/config_relations.yaml';
  });
  
  UsersController::extendFormFields(function($form, $model, $context) {
      if(!$model instanceof FrontUser or $context != 'preview'){
          // friends tab should not be displayed in update and create contexts
          return;
      }
  
      $form-&gt;addTabFields([
          'friends' =&gt; [
              'label' =&gt; '',
              'tab' =&gt; 'Friends',
              'type' =&gt; 'partial',
              'path' =&gt; '$/meysam/social/controllers/user/_friends.htm',
          ]
      ]);
  });
  </code></pre>
  
  <p>And here is the <code>config_relations.yaml</code> file:</p>
  
  <pre><code>friends:
      label: 'new friend'
      view:
          list: ~/plugins/meysam/social/models/friendspivot/columns.yaml
          toolbarButtons: add|remove
          showSearch: true
      manage:
          showSearch: true
          recordsPerPage: 10
          list: ~/plugins/rainlab/user/models/user/columns.yaml
      pivot:
          form: ~/plugins/meysam/social/models/friendspivot/fields.yaml
  </code></pre>
  
  <p>Now in the friends tab, list of are friends of the currently selected user are shown and when I click on <code>Add new friend</code> button, the list of all users is shown (<code>manage.list</code>) so that one of the users could be selected as the new friend. My problem is that in this list, all users are shown, even the currently selected user, and therefor a user can be added as his own friend. How can I filter out the current user from this list? I thought of using <code>scope</code> property but then this scope should be dynamic and I don't know how to pass the <code>user_id</code> of the current <code>User Model</code> to this scope. </p>