mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
Add a way to refine shortcuts
- Add a field `allowed_groups` to shortcuts, which will contain groups which can access a particular app - When a user is logged in, only return those shortcuts to the front page if the user is allowed to access them. This check is done based on the allowed_groups field of the shortcut - Add allowed_groups for shortcuts of all apps with group-restricted access Signed-off-by: Hemanth Kumar Veeranki <hemanthveeranki@gmail.com> Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
1 parent
eb0acca0f8
commit
b605c9da8a
9 files changed
+45
-17
No files matched your search
@@ -43,9 +43,10 @@ def access_info(request, **kwargs):
|
||||
def shortcuts(request, **kwargs):
|
||||
"""API view to return the list of frontpage services."""
|
||||
# XXX: Get the module (or module name) from shortcut properly.
|
||||
username = str(request.user) if request.user.is_authenticated else None
|
||||
shortcuts = [
|
||||
_get_shortcut_data(shortcut['id'].split('_')[0], shortcut)
|
||||
for shortcut in frontpage.get_shortcuts()
|
||||
for shortcut in frontpage.get_shortcuts(username)
|
||||
]
|
||||
response = {'shortcuts': shortcuts}
|
||||
return HttpResponse(
|
||||
|
||||
Reference in new issue
Block a user