Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
Gets intranet working in principle
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Krienbühl committed Nov 14, 2017
1 parent c499644 commit 1c5725e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
5 changes: 5 additions & 0 deletions onegov/intranet/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@

class IntranetApp(OrgApp):
pass


@IntranetApp.setting(section='org', name='enable_yubikey')
def get_enable_yubikey():
return True
38 changes: 38 additions & 0 deletions onegov/intranet/security.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from onegov.core.security import Public, Private, Personal, Secret
from onegov.core.static import StaticFile
from onegov.core.theme import ThemeFile
from onegov.intranet.app import IntranetApp
from onegov.user import Auth


@IntranetApp.setting_section(section="roles")
Expand Down Expand Up @@ -50,3 +53,38 @@ def get_roles_setting():
# the public has no access whatsoever
'anonymous': set()
}


@IntranetApp.permission_rule(
model=StaticFile,
permission=Public,
identity=None)
def may_view_static_files_not_logged_in(app, identity, model, permission):
""" Always allow to view static files.
Those files are public anyway, since we are open-source.
"""
return True


@IntranetApp.permission_rule(
model=ThemeFile,
permission=Public,
identity=None)
def may_view_theme_files_not_logged_in(app, identity, model, permission):
""" Always allow to view theme files.
Those files are public anyway, since we are open-source.
"""
return True


@IntranetApp.permission_rule(
model=Auth,
permission=Public,
identity=None)
def may_view_auth_not_logged_in(app, identity, model, permission):
""" Anonymous needs to be able to log in. """
return True

0 comments on commit 1c5725e

Please sign in to comment.