# Have a shortcut that appears only to logged in users

**URL:** <https://discuss.freedombox.org/t/have-a-shortcut-that-appears-only-to-logged-in-users/1107>\
**Category:** Uncategorized\
**Created:** [September 24, 2020, 4:00pm UTC](https://discuss.freedombox.org/t/have-a-shortcut-that-appears-only-to-logged-in-users/1107 "2020-09-24T16:00:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![byhisdeeds](https://discuss.freedombox.org/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@byhisdeeds](https://discuss.freedombox.org/u/byhisdeeds)\
**Post date:** [September 24, 2020, 4:00pm UTC](https://discuss.freedombox.org/t/have-a-shortcut-that-appears-only-to-logged-in-users/1107/1 "2020-09-24T16:00:54Z")

</div>

I’m looking for how to have an app that’s I have defined in the custom-shortcuts.json appear on the FreedomBox homepage ONLY AFTER a user has logged in.

Is this possible without me having to create a python app.

---

<div class="post-metadata">

**Author:** ![Sunil](https://discuss.freedombox.org/user_avatar/discuss.freedombox.org/sunil/32/8_2.png) [@Sunil](https://discuss.freedombox.org/u/Sunil)\
**Post date:** [September 24, 2020, 6:13pm UTC](https://discuss.freedombox.org/t/have-a-shortcut-that-appears-only-to-logged-in-users/1107/2 "2020-09-24T18:13:06Z")

</div>

Unfortunately, we are not picking up the login\_required field from custom shortcuts file and passing it on to the framework. So, this will require a tiny change to the framework in frontpage.py::add\_custom\_shortcuts(). Created an issue: [https://salsa.debian.org/freedombox-team/freedombox/-/issues/1968](https://salsa.debian.org/freedombox-team/freedombox/-/issues/1968) . Have a stab at it if you know Python.

---

<div class="post-metadata">

**Author:** ![byhisdeeds](https://discuss.freedombox.org/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@byhisdeeds](https://discuss.freedombox.org/u/byhisdeeds)\
**Post date:** [September 26, 2020, 5:08pm UTC](https://discuss.freedombox.org/t/have-a-shortcut-that-appears-only-to-logged-in-users/1107/4 "2020-09-26T17:08:53Z")

</div>

Ok, so I found the file

> ls /usr/lib/python3/dist-packages/plinth/frontpage.py

, and in the function **add\_custom\_shortcuts()**, I changed the line

```
component = Shortcut(component_id, shortcut['name'],
                             shortcut['short_description'],
                             icon=shortcut['icon_url'], url=web_app_url)

```

to

```
component = Shortcut(component_id, shortcut['name'],
                             shortcut['short_description'],
                             icon=shortcut['icon_url'], url=web_app_url,
                             login_required=shortcut['login_required'])

```

and restarted plinth with

> sudo systemctl restart plinth

and it seems to work. One question. Will these changes be permanent, or will I have to make them everytime I update/upgrade plinth.

---

<div class="post-metadata">

**Author:** ![Sunil](https://discuss.freedombox.org/user_avatar/discuss.freedombox.org/sunil/32/8_2.png) [@Sunil](https://discuss.freedombox.org/u/Sunil)\
**Post date:** [September 29, 2020, 6:55pm UTC](https://discuss.freedombox.org/t/have-a-shortcut-that-appears-only-to-logged-in-users/1107/5 "2020-09-29T18:55:42Z")

</div>

These changes will be overridden when new version of FreedomBox is automatically installed. The best thing to do is submit your change to the code repository as a merge request. Before you do:

- Make sure that when login\_required property is not provided, it is assumed to be False by doing shortcut.get(‘login\_required’, False).
- Run and fix any unit tests.

Checkout HACKING.md and CONTRIBUTORS.md for more details.
