Repository: privacyidea/privacyidea

Issue:
highlight search term in policy action search
While working making the changes for #2574, I found highlighting the search terms in the policy action search would be a big pro. This can be done using angular-internals.

> During the implementation of this feature, we could also highlight the search term using the angular module ui-utils as described here
> https://angular.de/artikel/mark-highlight-search-results/

_Originally posted by @laclaro in https://github.com/privacyidea/privacyidea/issues/2178#issuecomment-759389202_


Discussion:
We deactivated this feature in https://github.com/privacyidea/privacyidea/pull/2756 due to format-issues and a pending check for security vulnerabilities. The feature would be nice to have, so the reactivation would be great.
We would have to html-escape all descriptions, so that the highlighting will not break the description due to interpretation.

Could be done by changing all relevant descriptions or by a central server functionality.

Resolving patch:
diff --git a/privacyidea/lib/policy.py b/privacyidea/lib/policy.py
--- a/privacyidea/lib/policy.py
+++ b/privacyidea/lib/policy.py
@@ -1606,8 +1606,7 @@ def get_static_policy_definitions(scope=None):
             ACTION.UNASSIGN: {'type': 'bool',
                               'desc': _(
                                   'Admin is allowed to remove the token from '
-                                  'a user, '
-                                  'i.e. unassign a token.'),
+                                  'a user, i.e. unassign a token.'),
                               'mainmenu': [MAIN_MENU.TOKENS],
                               'group': GROUP.TOKEN},
             ACTION.IMPORT: {'type': 'bool',
@@ -1665,14 +1664,12 @@ def get_static_policy_definitions(scope=None):
             ACTION.COPYTOKENPIN: {'type': 'bool',
                                   'desc': _(
                                       'Admin is allowed to copy the PIN of '
-                                      'one token '
-                                      'to another token.'),
+                                      'one token to another token.'),
                                   "group": GROUP.TOOLS},
             ACTION.COPYTOKENUSER: {'type': 'bool',
                                    'desc': _(
                                        'Admin is allowed to copy the assigned '
-                                       'user to another'
-                                       ' token, i.e. assign a user ot '
+                                       'user to another token, i.e. assign a user to '
                                        'another token.'),
                                    "group": GROUP.TOOLS},
             ACTION.LOSTTOKEN: {'type': 'bool',
diff --git a/privacyidea/lib/tokens/emailtoken.py b/privacyidea/lib/tokens/emailtoken.py
--- a/privacyidea/lib/tokens/emailtoken.py
+++ b/privacyidea/lib/tokens/emailtoken.py
@@ -162,14 +162,15 @@ def get_class_info(key=None, ret='all'):
                'policy': {SCOPE.AUTH: {
                    EMAILACTION.EMAILTEXT: {
                        'type': 'str',
-                       'desc': _('The text that will be sent via EMail for'
-                                 ' an EMail token. Use <otp> and <serial> '
-                                 'as parameters. You may also specify a filename '
-                                 'as email template starting with "file:".')},
+                       'desc': _('The text that will be sent via EMail for '
+                                 'an EMail-token. Several tags like {otp} and '
+                                 '{serial} can be used as parameters. You may '
+                                 'also specify a filename as email template '
+                                 'starting with "file:".')},
                    EMAILACTION.EMAILSUBJECT: {
                        'type': 'str',
-                       'desc': _('The subject of the EMail for'
-                                 ' an EMail token. Use <otp> and <serial> '
+                       'desc': _('The subject of the EMail for '
+                                 'an EMail token. Use tags like {otp} and {serial} '
                                  'as parameters.')},
                    EMAILACTION.EMAILAUTO: {
                        'type': 'bool',
diff --git a/privacyidea/lib/tokens/smstoken.py b/privacyidea/lib/tokens/smstoken.py
--- a/privacyidea/lib/tokens/smstoken.py
+++ b/privacyidea/lib/tokens/smstoken.py
@@ -207,8 +207,8 @@ def get_class_info(key=None, ret='all'):
                    SCOPE.AUTH: {
                         SMSACTION.SMSTEXT: {
                             'type': 'str',
-                            'desc': _('The text that will be send via SMS for'
-                                      ' an SMS token. Use <otp> and <serial> '
+                            'desc': _('The text that will be send via SMS for '
+                                      'an SMS token. Use tags like {otp} and {serial} '
                                       'as parameters.')},
                         SMSACTION.SMSAUTO: {
                             'type': 'bool',


Test patch: