Here is a first patch against the 1.0 branch which implement the "SpecialGroup" feature I describe on the group.
Using it
After applying the patch, quickstart a new sa-based project with identity enabled:
tg-admin quickstart -s -i Foo foo
Restrict the use of the welcome page with a permission in controller.py :
class Root(controllers.RootController):
@expose(template="youpi.templates.welcome")
@identity.require(identity.has_permission("privileged_access"))
def index(self):
After create the database, give that permission to visitors connected from local machine (from tg-admin shell) :
from turbogears.identity.conditions import from_host
g = SpecialGroup()
g.group_id = 1
g.group_name = 'LocalMachineVisitors'
g.display_name = 'Local visitors'
g.predicate = from_host('127.0.0.1')
session.save(g)
p = Permission(p)
p.permission_id = 1
p.permission_name = 'privileged_access'
p.special_groups.append(g)
session.save(p)
session.flush()
start the app, and try to connect from localhost, and then from another machine.
Limitations
- The patch is SQLAlchemy only
- New predicates testing special groups should be added
- I'm not sure the name "SpecialGroup" is the most adequate.