src/bbn/user/permissions.php
public function customize(array $arr): array
  {
    $res = [];
    if ( isset($arr[0]) ){
      foreach ( $arr as $a ){
        if ( isset($a['id']) && $this->has($a['id']) ){
          $res[] = $a;
        }
      }
    }
    else if ( isset($arr['items']) ){
      $res = $arr;
      unset($res['items']);
      foreach ( $arr['items'] as $a ){
        if ( isset($a['id']) && $this->has($a['id']) ){
          if ( !isset($res['items']) ){
            $res['items'] = [];
          }
          $res['items'][] = $a;
        }
      }
    }
    return $res;
  }
public function customize(array $arr): array
  {
    $res = [];
    if ( isset($arr[0]) ){
      foreach ( $arr as $a ){
        if ( isset($a['id']) && $this->has($a['id']) ){
          $res[] = $a;
        }
      }
    }
    else if ( isset($arr['items']) ){
      $res = $arr;
      unset($res['items']);
      foreach ( $arr['items'] as $a ){
        if ( isset($a['id']) && $this->has($a['id']) ){
          if ( !isset($res['items']) ){
            $res['items'] = [];
          }
          $res['items'][] = $a;
        }
      }
    }
    return $res;
  }
public function customize ( array $ arr ) : array { $ res = [ ] ; if ( isset ( $ arr [ 0 ] ) ) { foreach ( $ arr as $ a ) { if ( isset ( $ a [ 'id' ] ) && $ this -> has ( $ a [ 'id' ] ) ) { $ res [ ] = $ a ; } } } else if ( isset ( $ arr [ 'items' ] ) ) { $ res = $ arr ; unset ( $ res [ 'items' ] ) ; foreach ( $ arr [ 'items' ] as $ a ) { if ( isset ( $ a [ 'id' ] ) && $ this -> has ( $ a [ 'id' ] ) ) { if ( ! isset ( $ res [ 'items' ] ) ) { $ res [ 'items' ] = [ ] ; } $ res [ 'items' ] [ ] = $ a ; } } } return $ res ; }
Adapts a given array of options' to user's permissions

@param array $arr
@return array
Adapts a given array of options to user s permissions