original_string: public static function get_assigned_privacy_officer_roles() {
          $roleids = [];
  
          // Get roles from config.
          $configroleids = explode(',', str_replace(' ', '', get_config('tool_dataprivacy', 'dporoles')));
          if (!empty($configroleids)) {
              // Fetch roles that have the capability to manage data requests.
              $capableroles = array_keys(get_roles_with_capability('tool/dataprivacy:managedatarequests'));
  
              // Extract the configured roles that have the capability from the list of capable roles.
              $roleids = array_intersect($capableroles, $configroleids);
          }
  
          return $roleids;
      }
code: public static function get_assigned_privacy_officer_roles() {
          $roleids = [];
  
          // Get roles from config.
          $configroleids = explode(',', str_replace(' ', '', get_config('tool_dataprivacy', 'dporoles')));
          if (!empty($configroleids)) {
              // Fetch roles that have the capability to manage data requests.
              $capableroles = array_keys(get_roles_with_capability('tool/dataprivacy:managedatarequests'));
  
              // Extract the configured roles that have the capability from the list of capable roles.
              $roleids = array_intersect($capableroles, $configroleids);
          }
  
          return $roleids;
      }
code_tokens: public static function get_assigned_privacy_officer_roles ( ) { $ roleids = [ ] ; // Get roles from config. $ configroleids = explode ( ',' , str_replace ( ' ' , '' , get_config ( 'tool_dataprivacy' , 'dporoles' ) ) ) ; if ( ! empty ( $ configroleids ) ) { // Fetch roles that have the capability to manage data requests. $ capableroles = array_keys ( get_roles_with_capability ( 'tool/dataprivacy:managedatarequests' ) ) ; // Extract the configured roles that have the capability from the list of capable roles. $ roleids = array_intersect ( $ capableroles , $ configroleids ) ; } return $ roleids ; }
docstring: Fetches the list of configured privacy officer roles.
  
  Every time this function is called, it checks each role if they have the 'managedatarequests' capability and removes
  any role that doesn't have the required capability anymore.
  
  @return int[]
  @throws dml_exception
docstring_tokens: Fetches the list of configured privacy officer roles .