prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Hidden scores, hides graphs for admins as well
  Hidden scores, hides graphs for admins as well. 
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `CTFd/utils/decorators/visibility.py`
  Content:
  ```
  1 import functools
  2 
  3 from flask import abort, redirect, render_template, request, url_for
  4 
  5 from CTFd.constants.config import (
  6     AccountVisibilityTypes,
  7     ChallengeVisibilityTypes,
  8     ConfigTypes,
  9     RegistrationVisibilityTypes,
  10     ScoreVisibilityTypes,
  11 )
  12 from CTFd.utils import get_config
  13 from CTFd.utils.user import authed, is_admin
  14 
  15 
  16 def check_score_visibility(f):
  17     @functools.wraps(f)
  18     def _check_score_visibility(*args, **kwargs):
  19         v = get_config(ConfigTypes.SCORE_VISIBILITY)
  20         if v == ScoreVisibilityTypes.PUBLIC:
  21             return f(*args, **kwargs)
  22 
  23         elif v == ScoreVisibilityTypes.PRIVATE:
  24             if authed():
  25                 return f(*args, **kwargs)
  26             else:
  27                 if request.content_type == "application/json":
  28                     abort(403)
  29                 else:
  30                     return redirect(url_for("auth.login", next=request.full_path))
  31 
  32         elif v == ScoreVisibilityTypes.HIDDEN:
  33             return (
  34                 render_template("errors/403.html", error="Scores are currently hidden"),
  35                 403,
  36             )
  37 
  38         elif v == ScoreVisibilityTypes.ADMINS:
  39             if is_admin():
  40                 return f(*args, **kwargs)
  41             else:
  42                 abort(404)
  43 
  44     return _check_score_visibility
  45 
  46 
  47 def check_challenge_visibility(f):
  48     @functools.wraps(f)
  49     def _check_challenge_visibility(*args, **kwargs):
  50         v = get_config(ConfigTypes.CHALLENGE_VISIBILITY)
  51         if v == ChallengeVisibilityTypes.PUBLIC:
  52             return f(*args, **kwargs)
  53 
  54         elif v == ChallengeVisibilityTypes.PRIVATE:
  55             if authed():
  56                 return f(*args, **kwargs)
  57             else:
  58                 if request.content_type == "application/json":
  59                     abort(403)
  60                 else:
  61                     return redirect(url_for("auth.login", next=request.full_path))
  62 
  63         elif v == ChallengeVisibilityTypes.ADMINS:
  64             if is_admin():
  65                 return f(*args, **kwargs)
  66             else:
  67                 if authed():
  68                     abort(403)
  69                 else:
  70                     return redirect(url_for("auth.login", next=request.full_path))
  71 
  72     return _check_challenge_visibility
  73 
  74 
  75 def check_account_visibility(f):
  76     @functools.wraps(f)
  77     def _check_account_visibility(*args, **kwargs):
  78         v = get_config(ConfigTypes.ACCOUNT_VISIBILITY)
  79         if v == AccountVisibilityTypes.PUBLIC:
  80             return f(*args, **kwargs)
  81 
  82         elif v == AccountVisibilityTypes.PRIVATE:
  83             if authed():
  84                 return f(*args, **kwargs)
  85             else:
  86                 if request.content_type == "application/json":
  87                     abort(403)
  88                 else:
  89                     return redirect(url_for("auth.login", next=request.full_path))
  90 
  91         elif v == AccountVisibilityTypes.ADMINS:
  92             if is_admin():
  93                 return f(*args, **kwargs)
  94             else:
  95                 abort(404)
  96 
  97     return _check_account_visibility
  98 
  99 
  100 def check_registration_visibility(f):
  101     @functools.wraps(f)
  102     def _check_registration_visibility(*args, **kwargs):
  103         v = get_config(ConfigTypes.REGISTRATION_VISIBILITY)
  104         if v == RegistrationVisibilityTypes.PUBLIC:
  105             return f(*args, **kwargs)
  106         elif v == RegistrationVisibilityTypes.PRIVATE:
  107             abort(404)
  108 
  109     return _check_registration_visibility
  110
  ```
  
  Path: `CTFd/scoreboard.py`
  Content:
  ```
  1 from flask import Blueprint, render_template
  2 
  3 from CTFd.cache import cache, make_cache_key
  4 from CTFd.utils import config
  5 from CTFd.utils.decorators.visibility import check_score_visibility
  6 from CTFd.utils.helpers import get_infos
  7 from CTFd.utils.scores import get_standings
  8 
  9 scoreboard = Blueprint("scoreboard", __name__)
  10 
  11 
  12 @scoreboard.route("/scoreboard")
  13 @check_score_visibility
  14 @cache.cached(timeout=60, key_prefix=make_cache_key)
  15 def listing():
  16     infos = get_infos()
  17 
  18     if config.is_scoreboard_frozen():
  19         infos.append("Scoreboard has been frozen")
  20 
  21     standings = get_standings()
  22     return render_template("scoreboard.html", standings=standings, infos=infos)
  23
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/CTFd/scoreboard.py b/CTFd/scoreboard.py
  --- a/CTFd/scoreboard.py
  +++ b/CTFd/scoreboard.py
  @@ -2,9 +2,11 @@
   
   from CTFd.cache import cache, make_cache_key
   from CTFd.utils import config
  +from CTFd.utils.config.visibility import scores_visible
   from CTFd.utils.decorators.visibility import check_score_visibility
   from CTFd.utils.helpers import get_infos
   from CTFd.utils.scores import get_standings
  +from CTFd.utils.user import is_admin
   
   scoreboard = Blueprint("scoreboard", __name__)
   
  @@ -18,5 +20,8 @@
       if config.is_scoreboard_frozen():
           infos.append("Scoreboard has been frozen")
   
  +    if is_admin() is True and scores_visible() is False:
  +        infos.append("Scores are not currently visible to users")
  +
       standings = get_standings()
       return render_template("scoreboard.html", standings=standings, infos=infos)
  diff --git a/CTFd/utils/decorators/visibility.py b/CTFd/utils/decorators/visibility.py
  --- a/CTFd/utils/decorators/visibility.py
  +++ b/CTFd/utils/decorators/visibility.py
  @@ -30,10 +30,18 @@
                       return redirect(url_for("auth.login", next=request.full_path))
   
           elif v == ScoreVisibilityTypes.HIDDEN:
  -            return (
  -                render_template("errors/403.html", error="Scores are currently hidden"),
  -                403,
  -            )
  +            if is_admin():
  +                return f(*args, **kwargs)
  +            else:
  +                if request.content_type == "application/json":
  +                    abort(403)
  +                else:
  +                    return (
  +                        render_template(
  +                            "errors/403.html", error="Scores are currently hidden"
  +                        ),
  +                        403,
  +                    )
   
           elif v == ScoreVisibilityTypes.ADMINS:
               if is_admin():
  
verification_info: {"golden_diff": "diff --git a/CTFd/scoreboard.py b/CTFd/scoreboard.py\n--- a/CTFd/scoreboard.py\n+++ b/CTFd/scoreboard.py\n@@ -2,9 +2,11 @@\n \n from CTFd.cache import cache, make_cache_key\n from CTFd.utils import config\n+from CTFd.utils.config.visibility import scores_visible\n from CTFd.utils.decorators.visibility import check_score_visibility\n from CTFd.utils.helpers import get_infos\n from CTFd.utils.scores import get_standings\n+from CTFd.utils.user import is_admin\n \n scoreboard = Blueprint(\"scoreboard\", __name__)\n \n@@ -18,5 +20,8 @@\n     if config.is_scoreboard_frozen():\n         infos.append(\"Scoreboard has been frozen\")\n \n+    if is_admin() is True and scores_visible() is False:\n+        infos.append(\"Scores are not currently visible to users\")\n+\n     standings = get_standings()\n     return render_template(\"scoreboard.html\", standings=standings, infos=infos)\ndiff --git a/CTFd/utils/decorators/visibility.py b/CTFd/utils/decorators/visibility.py\n--- a/CTFd/utils/decorators/visibility.py\n+++ b/CTFd/utils/decorators/visibility.py\n@@ -30,10 +30,18 @@\n                     return redirect(url_for(\"auth.login\", next=request.full_path))\n \n         elif v == ScoreVisibilityTypes.HIDDEN:\n-            return (\n-                render_template(\"errors/403.html\", error=\"Scores are currently hidden\"),\n-                403,\n-            )\n+            if is_admin():\n+                return f(*args, **kwargs)\n+            else:\n+                if request.content_type == \"application/json\":\n+                    abort(403)\n+                else:\n+                    return (\n+                        render_template(\n+                            \"errors/403.html\", error=\"Scores are currently hidden\"\n+                        ),\n+                        403,\n+                    )\n \n         elif v == ScoreVisibilityTypes.ADMINS:\n             if is_admin():\n", "issue": "Hidden scores, hides graphs for admins as well\nHidden scores, hides graphs for admins as well. \n", "before_files": [{"content": "import functools\n\nfrom flask import abort, redirect, render_template, request, url_for\n\nfrom CTFd.constants.config import (\n    AccountVisibilityTypes,\n    ChallengeVisibilityTypes,\n    ConfigTypes,\n    RegistrationVisibilityTypes,\n    ScoreVisibilityTypes,\n)\nfrom CTFd.utils import get_config\nfrom CTFd.utils.user import authed, is_admin\n\n\ndef check_score_visibility(f):\n    @functools.wraps(f)\n    def _check_score_visibility(*args, **kwargs):\n        v = get_config(ConfigTypes.SCORE_VISIBILITY)\n        if v == ScoreVisibilityTypes.PUBLIC:\n            return f(*args, **kwargs)\n\n        elif v == ScoreVisibilityTypes.PRIVATE:\n            if authed():\n                return f(*args, **kwargs)\n            else:\n                if request.content_type == \"application/json\":\n                    abort(403)\n                else:\n                    return redirect(url_for(\"auth.login\", next=request.full_path))\n\n        elif v == ScoreVisibilityTypes.HIDDEN:\n            return (\n                render_template(\"errors/403.html\", error=\"Scores are currently hidden\"),\n                403,\n            )\n\n        elif v == ScoreVisibilityTypes.ADMINS:\n            if is_admin():\n                return f(*args, **kwargs)\n            else:\n                abort(404)\n\n    return _check_score_visibility\n\n\ndef check_challenge_visibility(f):\n    @functools.wraps(f)\n    def _check_challenge_visibility(*args, **kwargs):\n        v = get_config(ConfigTypes.CHALLENGE_VISIBILITY)\n        if v == ChallengeVisibilityTypes.PUBLIC:\n            return f(*args, **kwargs)\n\n        elif v == ChallengeVisibilityTypes.PRIVATE:\n            if authed():\n                return f(*args, **kwargs)\n            else:\n                if request.content_type == \"application/json\":\n                    abort(403)\n                else:\n                    return redirect(url_for(\"auth.login\", next=request.full_path))\n\n        elif v == ChallengeVisibilityTypes.ADMINS:\n            if is_admin():\n                return f(*args, **kwargs)\n            else:\n                if authed():\n                    abort(403)\n                else:\n                    return redirect(url_for(\"auth.login\", next=request.full_path))\n\n    return _check_challenge_visibility\n\n\ndef check_account_visibility(f):\n    @functools.wraps(f)\n    def _check_account_visibility(*args, **kwargs):\n        v = get_config(ConfigTypes.ACCOUNT_VISIBILITY)\n        if v == AccountVisibilityTypes.PUBLIC:\n            return f(*args, **kwargs)\n\n        elif v == AccountVisibilityTypes.PRIVATE:\n            if authed():\n                return f(*args, **kwargs)\n            else:\n                if request.content_type == \"application/json\":\n                    abort(403)\n                else:\n                    return redirect(url_for(\"auth.login\", next=request.full_path))\n\n        elif v == AccountVisibilityTypes.ADMINS:\n            if is_admin():\n                return f(*args, **kwargs)\n            else:\n                abort(404)\n\n    return _check_account_visibility\n\n\ndef check_registration_visibility(f):\n    @functools.wraps(f)\n    def _check_registration_visibility(*args, **kwargs):\n        v = get_config(ConfigTypes.REGISTRATION_VISIBILITY)\n        if v == RegistrationVisibilityTypes.PUBLIC:\n            return f(*args, **kwargs)\n        elif v == RegistrationVisibilityTypes.PRIVATE:\n            abort(404)\n\n    return _check_registration_visibility\n", "path": "CTFd/utils/decorators/visibility.py"}, {"content": "from flask import Blueprint, render_template\n\nfrom CTFd.cache import cache, make_cache_key\nfrom CTFd.utils import config\nfrom CTFd.utils.decorators.visibility import check_score_visibility\nfrom CTFd.utils.helpers import get_infos\nfrom CTFd.utils.scores import get_standings\n\nscoreboard = Blueprint(\"scoreboard\", __name__)\n\n\n@scoreboard.route(\"/scoreboard\")\n@check_score_visibility\n@cache.cached(timeout=60, key_prefix=make_cache_key)\ndef listing():\n    infos = get_infos()\n\n    if config.is_scoreboard_frozen():\n        infos.append(\"Scoreboard has been frozen\")\n\n    standings = get_standings()\n    return render_template(\"scoreboard.html\", standings=standings, infos=infos)\n", "path": "CTFd/scoreboard.py"}], "after_files": [{"content": "import functools\n\nfrom flask import abort, redirect, render_template, request, url_for\n\nfrom CTFd.constants.config import (\n    AccountVisibilityTypes,\n    ChallengeVisibilityTypes,\n    ConfigTypes,\n    RegistrationVisibilityTypes,\n    ScoreVisibilityTypes,\n)\nfrom CTFd.utils import get_config\nfrom CTFd.utils.user import authed, is_admin\n\n\ndef check_score_visibility(f):\n    @functools.wraps(f)\n    def _check_score_visibility(*args, **kwargs):\n        v = get_config(ConfigTypes.SCORE_VISIBILITY)\n        if v == ScoreVisibilityTypes.PUBLIC:\n            return f(*args, **kwargs)\n\n        elif v == ScoreVisibilityTypes.PRIVATE:\n            if authed():\n                return f(*args, **kwargs)\n            else:\n                if request.content_type == \"application/json\":\n                    abort(403)\n                else:\n                    return redirect(url_for(\"auth.login\", next=request.full_path))\n\n        elif v == ScoreVisibilityTypes.HIDDEN:\n            if is_admin():\n                return f(*args, **kwargs)\n            else:\n                if request.content_type == \"application/json\":\n                    abort(403)\n                else:\n                    return (\n                        render_template(\n                            \"errors/403.html\", error=\"Scores are currently hidden\"\n                        ),\n                        403,\n                    )\n\n        elif v == ScoreVisibilityTypes.ADMINS:\n            if is_admin():\n                return f(*args, **kwargs)\n            else:\n                abort(404)\n\n    return _check_score_visibility\n\n\ndef check_challenge_visibility(f):\n    @functools.wraps(f)\n    def _check_challenge_visibility(*args, **kwargs):\n        v = get_config(ConfigTypes.CHALLENGE_VISIBILITY)\n        if v == ChallengeVisibilityTypes.PUBLIC:\n            return f(*args, **kwargs)\n\n        elif v == ChallengeVisibilityTypes.PRIVATE:\n            if authed():\n                return f(*args, **kwargs)\n            else:\n                if request.content_type == \"application/json\":\n                    abort(403)\n                else:\n                    return redirect(url_for(\"auth.login\", next=request.full_path))\n\n        elif v == ChallengeVisibilityTypes.ADMINS:\n            if is_admin():\n                return f(*args, **kwargs)\n            else:\n                if authed():\n                    abort(403)\n                else:\n                    return redirect(url_for(\"auth.login\", next=request.full_path))\n\n    return _check_challenge_visibility\n\n\ndef check_account_visibility(f):\n    @functools.wraps(f)\n    def _check_account_visibility(*args, **kwargs):\n        v = get_config(ConfigTypes.ACCOUNT_VISIBILITY)\n        if v == AccountVisibilityTypes.PUBLIC:\n            return f(*args, **kwargs)\n\n        elif v == AccountVisibilityTypes.PRIVATE:\n            if authed():\n                return f(*args, **kwargs)\n            else:\n                if request.content_type == \"application/json\":\n                    abort(403)\n                else:\n                    return redirect(url_for(\"auth.login\", next=request.full_path))\n\n        elif v == AccountVisibilityTypes.ADMINS:\n            if is_admin():\n                return f(*args, **kwargs)\n            else:\n                abort(404)\n\n    return _check_account_visibility\n\n\ndef check_registration_visibility(f):\n    @functools.wraps(f)\n    def _check_registration_visibility(*args, **kwargs):\n        v = get_config(ConfigTypes.REGISTRATION_VISIBILITY)\n        if v == RegistrationVisibilityTypes.PUBLIC:\n            return f(*args, **kwargs)\n        elif v == RegistrationVisibilityTypes.PRIVATE:\n            abort(404)\n\n    return _check_registration_visibility\n", "path": "CTFd/utils/decorators/visibility.py"}, {"content": "from flask import Blueprint, render_template\n\nfrom CTFd.cache import cache, make_cache_key\nfrom CTFd.utils import config\nfrom CTFd.utils.config.visibility import scores_visible\nfrom CTFd.utils.decorators.visibility import check_score_visibility\nfrom CTFd.utils.helpers import get_infos\nfrom CTFd.utils.scores import get_standings\nfrom CTFd.utils.user import is_admin\n\nscoreboard = Blueprint(\"scoreboard\", __name__)\n\n\n@scoreboard.route(\"/scoreboard\")\n@check_score_visibility\n@cache.cached(timeout=60, key_prefix=make_cache_key)\ndef listing():\n    infos = get_infos()\n\n    if config.is_scoreboard_frozen():\n        infos.append(\"Scoreboard has been frozen\")\n\n    if is_admin() is True and scores_visible() is False:\n        infos.append(\"Scores are not currently visible to users\")\n\n    standings = get_standings()\n    return render_template(\"scoreboard.html\", standings=standings, infos=infos)\n", "path": "CTFd/scoreboard.py"}]}