sorrry, im not user PHP programin, is web2py/Python. Thanks.
Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com ovidiomari...@itjp.net.br ITJP - itjp.net.br 83 8826 9088 - Oi 83 9334 0266 - Claro Brasil 2012/6/30 Cliff Kachinske <cjk...@gmail.com>: > I implemented something similar using PHP years ago. > > The only advantage to using request_tenant is you don't have to type two > lines in every query: > > (db.mytable.identifier==session.auth.user.identifier) & > (db.mytable.is_active==True) > > But since we have snippets, it's not too hard :) > > > On Saturday, June 30, 2012 7:45:02 AM UTC-4, Ovidio Marinho wrote: >> >> Yes, I would like to Usai Id and not the host / ip. >> >> We know that multi-tentant came to automating a service saas in >> web2py, but as literature, and we lack a bit of a hurry to create one >> field in the table auth.user.hospital and popular with the same >> content of created_by, so we have a function in the controller >> >> def testegrupo (): >> rows = db (db.t_medico.f_hospital == auth.user.hospital). select () >> return dict (rows = rows) >> >> we know this is a hack of the tenant for web2py but it works. But I >> will implement the changes proposed in this DISCUSSION for the tenant >> to operate as a service saas. >> >> >> >> Ovidio Marinho Falcao Neto >> Web Developer >> ovidio...@gmail.com >> ovidiomari...@itjp.net.br >> ITJP - itjp.net.br >> 83 8826 9088 - Oi >> 83 9334 0266 - Claro >> Brasil >> >> >> >> 2012/6/29 Michele Comitini <michele.comit...@gmail.com>: >> > Ovidio, >> > >> > I wonder if you could use auth.user.id or auth.membership.id as key >> > instead of host/ip? >> > >> > If the above is not viable, Massimo suggestion to have separate >> > databases is very good IMHO and you can build a Data Warehouse >> > http://en.wikipedia.org/wiki/Data_warehouse by using postgresql >> > clustering capabilities or one of many postgresql synchronization >> > tools. >> > >> > mic >> > >> > >> > 2012/6/29 Ovidio Marinho <ovidio...@gmail.com>: >> >> Well now after my DAL I have Instructions >> >> db = DAL ('postgres :/ / postgres: passwd @ localhost: 5432/mybd') >> >> >> >> db._common_fields=Field('request_tenant',default=request.env.http_host,writable=False,readable=False)] >> >> >> >> What happened? in all my tables I have request_tenant the field, and >> >> when I do a drive automatically writes the localhost: 8000. But now >> >> how is that several users with different hosts with dhcp changing its >> >> access each time with a different ip that can work? >> >> >> >> this post from Massimo does exactly what I want with the school he has >> >> provided for various and simultaneous access, I could spend the >> >> Massimo setting this app? >> >> >> >> http://www.mail-archive.com/web2py@googlegroups.com/msg64351.html >> >> >> >> Ovidio Marinho Falcao Neto >> >> Web Developer >> >> ovidio...@gmail.com >> >> ovidiomari...@itjp.net.br >> >> ITJP - itjp.net.br >> >> 83 8826 9088 - Oi >> >> 83 9334 0266 - Claro >> >> Brasil >> >> >> >> >> >> >> >> 2012/6/28 Massimo Di Pierro <massimo.dipie...@gmail.com>: >> >>> Do me the issue is, should all data always be filtered by hospital. >> >>> If there should only be filtered in some cases and not in other, use >> >>> explicit queries >> >>> If some tables are always filtered and some are not, you may want to >> >>> use the >> >>> tenant feature. >> >>> >> >>> >> >>> On Thursday, 28 June 2012 05:45:13 UTC-5, Ovidio Marinho wrote: >> >>>> >> >>>> I can not split into separate database, as the management reports >> >>>> need >> >>>> to filter all information. What I need is that the data are shown to >> >>>> hosptal (1) is only seen by him. No problem if all hospitals being in >> >>>> the same database, so is the question of security in view. When the >> >>>> login Hospital (1) is made only data related to hospital (1) should >> >>>> appear on the screen. >> >>>> >> >>>> >> >>>> >> >>>> >> >>>> Ovidio Marinho Falcao Neto >> >>>> Web Developer >> >>>> ovidio...@gmail.com >> >>>> ovidiomari...@itjp.net.br >> >>>> ITJP - itjp.net.br >> >>>> 83 8826 9088 - Oi >> >>>> 83 9334 0266 - Claro >> >>>> Brasil >> >>>> >> >>>> >> >>>> >> >>>> 2012/6/27 Massimo Di Pierro <massimo.dipie...@gmail.com>: >> >>>> > I would suggest you use a different database (a different >> >>>> > connection >> >>>> > string) >> >>>> > for each hospital depending on the hostname. >> >>>> > >> >>>> > <hospital>.domain.com >> >>>> > import re; regex = re.compile('.*\://(.*?)/.* >> >>>> > db = DAL('postgresq://..../%s' % >> >>>> > regex.match(request.env.http_host).group(1)) >> >>>> > >> >>>> > In this way you keep your data separate (which is better for >> >>>> > security) >> >>>> > and >> >>>> > will allow you scale horizontally by setting up multiple db server >> >>>> > instances. >> >>>> > >> >>>> > >> >>>> > >> >>>> > On Wednesday, 27 June 2012 18:07:44 UTC-5, Ovidio Marinho wrote: >> >>>> >> >> >>>> >> I am making an application to control government medical >> >>>> >> appointments >> >>>> >> in more than fifty hospitals all use a single postgres database, >> >>>> >> but >> >>>> >> each hospital must have administrator access, Operator and User, >> >>>> >> and >> >>>> >> each access must be made with the view of their unique data . >> >>>> >> >> >>>> >> is this. >> >>>> >> >> >>>> >> >> >>>> >