private function buildMasterFieldPermissions(SubjectIdentityInterface $subject, array $permissions)
    {
        if ($this->hasConfig($subject->getType())) {
            $map = $this->getConfig($subject->getType())->getMasterFieldMappingPermissions();

            foreach ($permissions as &$permission) {
                if (false !== $key = array_search($permission, $map, true)) {
                    $permission = $key;
                }
            }
        }

        return $permissions;
    }