Re: [web2py] lgoin_bare WTF???

2018-12-14 Thread Anthony
You should not define custom Auth tables that break the existing Auth 
functionality. If you need a "group" table to be used outside the context 
of Auth, then simply name it something other than "auth_group". Otherwise, 
keep the standard auth_group fields and simply add extra fields that you 
need for your app.

Anthony

On Thursday, December 13, 2018 at 4:19:54 PM UTC-5, Ben Duncan wrote:
>
> Ok, I THINK the error is due to our custome tables
> ie: Group is defined as :
>
> db.define_table('auth_group',
> Field('group_id', type='integer'),
> Field('role', type='string', length=50),
> Field('description', type='string', length=256),
> Field('company_number', type='integer', default=0),
> Field('created_on', type='datetime'),
> Field('created_by', type='string', length=50),
> Field('modified_on', type='datetime'),
> Field('modified_by', type='string', length=50),
> Field('notes', type='text'),
> primarykey=['group_id'],
> migrate=False)
>
> SO (Correct me if I am wrong) it's trying to use the "self.user.id" which 
> is not defined, since these are cutome tables.
>
> If so, how to I go about correcting this ?
>
> As always, thanks ...
>
> *Ben Duncan*
> DBA / Chief Software Architect 
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Dec 13, 2018 at 3:06 PM Ben Duncan  wrote:
>
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect 
>> Mississippi State Supreme Court
>> Electronic Filing Division
>> Argg ... spoke to soon :
>>
>> Errors :
>>
>> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02 
>> Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr) 
>> Traceback 
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>>
>> Traceback (most recent call last):
>>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
>> exec(ccode, environment)
>>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
>> , line 
>> 205, in 
>>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
>> self._caller = lambda f: f()
>>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
>> , line 
>> 25, in user_bare
>> user = auth.login_bare(username, cryptpassword)
>>   File "/data/web2py/web2py/gluon/tools.py", line 2283, in login_bare
>> self.login_user(user)
>>   File "/data/web2py/web2py/gluon/authapi.py", line 739, in login_user
>> self.update_groups()
>>   File "/data/web2py/web2py/gluon/authapi.py", line 503, in update_groups
>> table_membership.user_id == self.user.id).select()
>>   File 
>> "/opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py",
>>  line 109, in __getattr__
>> raise AttributeError
>> AttributeError
>>
>> Error snapshot [image: help] 
>> 
>>  
>>
>> () 
>>
>> inspect attributes 
>> Frames 
>>
>>- 
>>
>>*File /data/web2py/web2py/gluon/restricted.py in restricted at line 
>>219* code arguments variables 
>>- 
>>
>>*File /data/web2py/web2py/applications/Mec/controllers/default.py in 
>> at line 205* code arguments variables 
>>- 
>>
>>*File /data/web2py/web2py/gluon/globals.py in  at line 421* 
>>code arguments variables 
>>- 
>>
>>*File /data/web2py/web2py/applications/Mec/controllers/default.py in 
>>user_bare at line 25* code arguments variables 
>>- 
>>
>>*File /data/web2py/web2py/gluon/tools.py in login_bare at line 2283* 
>>code arguments variables 
>>- 
>>
>>*File /data/web2py/web2py/gluon/authapi.py in login_user at line 739* 
>>code arguments variables 
>>- 
>>
>>*File /data/web2py/web2py/gluon/authapi.py in update_groups at line 
>>503* code arguments variables 
>>- 
>>
>>*File 
>>
>> /opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py
>>  
>>in __getattr__ at line 109* code arguments variables 
>>Function argument list 
>>
>>(self=>None, 'address_3': None, 'notes': None}>, k='id')
>>Code listing 
>>
>>104.
>>105.
>>106.
>>107.
>>108.
>>109.
>>110.
>>111.
>>112.
>>113.
>>
>>
>>def __getattr__(self, k):
>>try:
>>return self.__getitem__(k)
>>except KeyError:
>>raise AttributeError
>>
>>def __copy__(self):
>>return Row(self)
>>
>>Variables 
>>builtinAttributeError  
>>
>> Context 
>>
>> locals request session response 
>> In file: /data/web2py/web2py/applications/Mec/controllers/default.py 
>>
>> 1.
>>
>>  at 0x7f1259ef0

Re: [web2py] lgoin_bare WTF???

2018-12-14 Thread Richard Vézina
I would suggest you to use the new way of customizing auth tables :

"""

The simplest way is to add extra fields:

## after auth = Auth(db)
auth.settings.extra_fields['auth_user']= [
  Field('address'),
  Field('city'),
  Field('zip'),
  Field('phone')]
## before auth.define_tables(username=True)

"""
http://web2py.com/books/default/chapter/29/09/access-control#Customizing-Auth


On Thu, Dec 13, 2018 at 4:19 PM Ben Duncan  wrote:

> Ok, I THINK the error is due to our custome tables
> ie: Group is defined as :
>
> db.define_table('auth_group',
> Field('group_id', type='integer'),
> Field('role', type='string', length=50),
> Field('description', type='string', length=256),
> Field('company_number', type='integer', default=0),
> Field('created_on', type='datetime'),
> Field('created_by', type='string', length=50),
> Field('modified_on', type='datetime'),
> Field('modified_by', type='string', length=50),
> Field('notes', type='text'),
> primarykey=['group_id'],
> migrate=False)
>
> SO (Correct me if I am wrong) it's trying to use the "self.user.id" which
> is not defined, since these are cutome tables.
>
> If so, how to I go about correcting this ?
>
> As always, thanks ...
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Dec 13, 2018 at 3:06 PM Ben Duncan  wrote:
>
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>> Argg ... spoke to soon :
>>
>> Errors :
>>
>> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
>> Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
>> Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>>
>> Traceback (most recent call last):
>>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
>> exec(ccode, environment)
>>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
>> , line 
>> 205, in 
>>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
>> self._caller = lambda f: f()
>>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
>> , line 
>> 25, in user_bare
>> user = auth.login_bare(username, cryptpassword)
>>   File "/data/web2py/web2py/gluon/tools.py", line 2283, in login_bare
>> self.login_user(user)
>>   File "/data/web2py/web2py/gluon/authapi.py", line 739, in login_user
>> self.update_groups()
>>   File "/data/web2py/web2py/gluon/authapi.py", line 503, in update_groups
>> table_membership.user_id == self.user.id).select()
>>   File 
>> "/opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py",
>>  line 109, in __getattr__
>> raise AttributeError
>> AttributeError
>>
>> Error snapshot [image: help]
>> 
>>
>> ()
>>
>> inspect attributes
>> Frames
>>
>>-
>>
>>*File /data/web2py/web2py/gluon/restricted.py in restricted at line
>>219* code arguments variables
>>-
>>
>>*File /data/web2py/web2py/applications/Mec/controllers/default.py in
>> at line 205* code arguments variables
>>-
>>
>>*File /data/web2py/web2py/gluon/globals.py in  at line 421*
>>code arguments variables
>>-
>>
>>*File /data/web2py/web2py/applications/Mec/controllers/default.py in
>>user_bare at line 25* code arguments variables
>>-
>>
>>*File /data/web2py/web2py/gluon/tools.py in login_bare at line 2283*
>>code arguments variables
>>-
>>
>>*File /data/web2py/web2py/gluon/authapi.py in login_user at line 739*
>>code arguments variables
>>-
>>
>>*File /data/web2py/web2py/gluon/authapi.py in update_groups at line
>>503* code arguments variables
>>-
>>
>>*File
>>
>> /opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py
>>in __getattr__ at line 109* code arguments variables
>>Function argument list
>>
>>(self=>None, 'address_3': None, 'notes': None}>, k='id')
>>Code listing
>>
>>104.
>>105.
>>106.
>>107.
>>108.
>>109.
>>110.
>>111.
>>112.
>>113.
>>
>>
>>def __getattr__(self, k):
>>try:
>>return self.__getitem__(k)
>>except KeyError:
>>raise AttributeError
>>
>>def __copy__(self):
>>return Row(self)
>>
>>Variables
>>builtinAttributeError 
>>
>> Context
>>
>> locals request session response
>> In file: /data/web2py/web2py/applications/Mec/controllers/default.py
>>
>> 1.
>>
>>  at 0x7f1259ef06b0, file 
>> "/data/web2py/web2py/applications/Mec/controllers/default.py",

Re: [web2py] lgoin_bare WTF???

2018-12-13 Thread Ben Duncan
Ok, I THINK the error is due to our custome tables
ie: Group is defined as :

db.define_table('auth_group',
Field('group_id', type='integer'),
Field('role', type='string', length=50),
Field('description', type='string', length=256),
Field('company_number', type='integer', default=0),
Field('created_on', type='datetime'),
Field('created_by', type='string', length=50),
Field('modified_on', type='datetime'),
Field('modified_by', type='string', length=50),
Field('notes', type='text'),
primarykey=['group_id'],
migrate=False)

SO (Correct me if I am wrong) it's trying to use the "self.user.id" which
is not defined, since these are cutome tables.

If so, how to I go about correcting this ?

As always, thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 13, 2018 at 3:06 PM Ben Duncan  wrote:

>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
> Argg ... spoke to soon :
>
> Errors :
>
> web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
> Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
>
> Traceback (most recent call last):
>   File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
> , line 
> 205, in 
>   File "/data/web2py/web2py/gluon/globals.py", line 421, in 
> self._caller = lambda f: f()
>   File "/data/web2py/web2py/applications/Mec/controllers/default.py" 
> , line 25, 
> in user_bare
> user = auth.login_bare(username, cryptpassword)
>   File "/data/web2py/web2py/gluon/tools.py", line 2283, in login_bare
> self.login_user(user)
>   File "/data/web2py/web2py/gluon/authapi.py", line 739, in login_user
> self.update_groups()
>   File "/data/web2py/web2py/gluon/authapi.py", line 503, in update_groups
> table_membership.user_id == self.user.id).select()
>   File 
> "/opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py",
>  line 109, in __getattr__
> raise AttributeError
> AttributeError
>
> Error snapshot [image: help]
> 
>
> ()
>
> inspect attributes
> Frames
>
>-
>
>*File /data/web2py/web2py/gluon/restricted.py in restricted at line
>219* code arguments variables
>-
>
>*File /data/web2py/web2py/applications/Mec/controllers/default.py in
> at line 205* code arguments variables
>-
>
>*File /data/web2py/web2py/gluon/globals.py in  at line 421*
>code arguments variables
>-
>
>*File /data/web2py/web2py/applications/Mec/controllers/default.py in
>user_bare at line 25* code arguments variables
>-
>
>*File /data/web2py/web2py/gluon/tools.py in login_bare at line 2283*
>code arguments variables
>-
>
>*File /data/web2py/web2py/gluon/authapi.py in login_user at line 739*
>code arguments variables
>-
>
>*File /data/web2py/web2py/gluon/authapi.py in update_groups at line
>503* code arguments variables
>-
>
>*File
>
> /opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py
>in __getattr__ at line 109* code arguments variables
>Function argument list
>
>(self=None, 'address_3': None, 'notes': None}>, k='id')
>Code listing
>
>104.
>105.
>106.
>107.
>108.
>109.
>110.
>111.
>112.
>113.
>
>
>def __getattr__(self, k):
>try:
>return self.__getitem__(k)
>except KeyError:
>raise AttributeError
>
>def __copy__(self):
>return Row(self)
>
>Variables
>builtinAttributeError 
>
> Context
>
> locals request session response
> In file: /data/web2py/web2py/applications/Mec/controllers/default.py
>
> 1.
>
>  at 0x7f1259ef06b0, file 
> "/data/web2py/web2py/applications/Mec/controllers/default.py", line 11>
>
>
> On Thu, Dec 13, 2018 at 3:02 PM Ben Duncan  wrote:
>
>> Ok, I seem to have it working now:
>>
>> My Code Snippets if anyone is interested:
>>
>> controllers/default.py
>> def user_bare():
>> alg = 'pbkdf2(1000,20,sha512)'
>> custom_auth_table.password.requires = None
>> username, password = request.post_vars['username'],
>> request.post_vars['password']
>> session.is_logged_in = "NO"
>> cryptpassword =
>> str(CRYPT(digest_alg=alg,salt='Mars_Salt_4u')(password)[0])
>>
>> user = auth.login_bare(username, cryptpassword)
>>
>> #if auth.is_logged_in() :
>> if user :
>>s

Re: [web2py] lgoin_bare WTF???

2018-12-13 Thread Ben Duncan
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division
Argg ... spoke to soon :

Errors :

web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02
Python Python 2.7.13: /usr/bin/python (prefix: /opt/rh/python27/root/usr)
Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.

Traceback (most recent call last):
  File "/data/web2py/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
,
line 205, in 
  File "/data/web2py/web2py/gluon/globals.py", line 421, in 
self._caller = lambda f: f()
  File "/data/web2py/web2py/applications/Mec/controllers/default.py"
,
line 25, in user_bare
user = auth.login_bare(username, cryptpassword)
  File "/data/web2py/web2py/gluon/tools.py", line 2283, in login_bare
self.login_user(user)
  File "/data/web2py/web2py/gluon/authapi.py", line 739, in login_user
self.update_groups()
  File "/data/web2py/web2py/gluon/authapi.py", line 503, in update_groups
table_membership.user_id == self.user.id).select()
  File 
"/opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py",
line 109, in __getattr__
raise AttributeError
AttributeError

Error snapshot [image: help]


()

inspect attributes
Frames

   -

   *File /data/web2py/web2py/gluon/restricted.py in restricted at line 219*
   code arguments variables
   -

   *File /data/web2py/web2py/applications/Mec/controllers/default.py in
at line 205* code arguments variables
   -

   *File /data/web2py/web2py/gluon/globals.py in  at line 421* code
   arguments variables
   -

   *File /data/web2py/web2py/applications/Mec/controllers/default.py in
   user_bare at line 25* code arguments variables
   -

   *File /data/web2py/web2py/gluon/tools.py in login_bare at line 2283* code
   arguments variables
   -

   *File /data/web2py/web2py/gluon/authapi.py in login_user at line 739*
   code arguments variables
   -

   *File /data/web2py/web2py/gluon/authapi.py in update_groups at line 503*
   code arguments variables
   -

   *File
   
/opt/rh/python27/root/usr/lib/python2.7/site-packages/pyDAL-17.11-py2.7.egg/pydal/objects.py
   in __getattr__ at line 109* code arguments variables
   Function argument list

   (self=, k='id')
   Code listing

   104.
   105.
   106.
   107.
   108.
   109.
   110.
   111.
   112.
   113.


   def __getattr__(self, k):
   try:
   return self.__getitem__(k)
   except KeyError:
   raise AttributeError

   def __copy__(self):
   return Row(self)

   Variables
   builtinAttributeError 

Context

locals request session response
In file: /data/web2py/web2py/applications/Mec/controllers/default.py

1.

 at 0x7f1259ef06b0, file
"/data/web2py/web2py/applications/Mec/controllers/default.py", line
11>


On Thu, Dec 13, 2018 at 3:02 PM Ben Duncan  wrote:

> Ok, I seem to have it working now:
>
> My Code Snippets if anyone is interested:
>
> controllers/default.py
> def user_bare():
> alg = 'pbkdf2(1000,20,sha512)'
> custom_auth_table.password.requires = None
> username, password = request.post_vars['username'],
> request.post_vars['password']
> session.is_logged_in = "NO"
> cryptpassword =
> str(CRYPT(digest_alg=alg,salt='Mars_Salt_4u')(password)[0])
>
> user = auth.login_bare(username, cryptpassword)
>
> #if auth.is_logged_in() :
> if user :
>session.is_logged_in = "YES"
>if auth.user['company_number'] == 0:
>  redirect(URL('company_choose'))
>else:
>  redirect(URL('index'))
>
> return dict()
>
>
> view/default/user_bar.html
>
> {{extend 'layout.html'}}
>
>  onclick="location.href='{{=URL('index')}}'"/>
>
>action="{{=URL()}}" method="post"> 
>  
>   
>  
>  
>   
>  
>  
>Submit
>  
>  
>
>
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Dec 13, 2018 at 2:57 PM Ben Duncan  wrote:
>
>> Ok, thanks, will revisit it. I was getting insert errors from it before.
>> Maybe my ignorance ...
>>
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Thu, Dec 13, 2018 at 2:14 PM Anthony  wrote:
>>
>>> Got it, but I don't see login_bare/login_user/update_groups getting in
>>> the way of any of that. The update_groups method simply adds a dictionary
>>> of the user's current group ids/roles to the session, which can be used
>>> instead of doing a database lookup on each request. You are free to ignore
>>> it.
>>>
>>> Anthony
>>>

Re: [web2py] lgoin_bare WTF???

2018-12-13 Thread Ben Duncan
Ok, I seem to have it working now:

My Code Snippets if anyone is interested:

controllers/default.py
def user_bare():
alg = 'pbkdf2(1000,20,sha512)'
custom_auth_table.password.requires = None
username, password = request.post_vars['username'],
request.post_vars['password']
session.is_logged_in = "NO"
cryptpassword =
str(CRYPT(digest_alg=alg,salt='Mars_Salt_4u')(password)[0])

user = auth.login_bare(username, cryptpassword)

#if auth.is_logged_in() :
if user :
   session.is_logged_in = "YES"
   if auth.user['company_number'] == 0:
 redirect(URL('company_choose'))
   else:
 redirect(URL('index'))

return dict()


view/default/user_bar.html

{{extend 'layout.html'}}



 
 
  
 
 
  
 
 
   Submit
 
 



*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 13, 2018 at 2:57 PM Ben Duncan  wrote:

> Ok, thanks, will revisit it. I was getting insert errors from it before.
> Maybe my ignorance ...
>
>
> *Ben Duncan*
> DBA / Chief Software Architect
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Dec 13, 2018 at 2:14 PM Anthony  wrote:
>
>> Got it, but I don't see login_bare/login_user/update_groups getting in
>> the way of any of that. The update_groups method simply adds a dictionary
>> of the user's current group ids/roles to the session, which can be used
>> instead of doing a database lookup on each request. You are free to ignore
>> it.
>>
>> Anthony
>>
>> On Thursday, December 13, 2018 at 11:34:05 AM UTC-5, Ben Duncan wrote:
>>>
>>> Thanks Anthony.
>>>
>>> I'm trying to maintain some reference to the auth mechanism , but our
>>> needs get a little more convoluted.
>>>
>>> Some Background Info:
>>> This is a accounting system (AR/AP/GL/IV/OE/PR/BI/BR/RMA/ ..etc) based
>>> upon about 30 years of collected source
>>> I have for Chancery / Circuit Clerks for Fees, Fines and restitution and
>>> land records et.all.
>>>
>>> I'm trying to keep it generic as possible for the Supreme Court.
>>>
>>> From the Clerks view, the are elected officials for a particular
>>> County/Jurisdiction. However, in some instances the may cover several
>>> counties / courts (if those are small).
>>>
>>> Courts are grouped in "districts" and we are going to using "company id"
>>> numbers to signify those courts within the districts and all courts under
>>> one
>>> umbrella for the database.
>>>
>>> Now the CLERKS have deputy clerks, who may OR may not be assigned to
>>> multiple county/courts and may be limited to WHAT or what they cannot
>>> do, but are designated by the "company" code to which court they will
>>> have access to.
>>> Add to that, the wants of our Office of the State Auditors our very own
>>> AOC (Administrator of Courts and their auditors) it gets pretty
>>> convulsed in a hurry.
>>>
>>> Now looking at the ACCESS CONTROL stuff, we are really a flipped version
>>> of that - GROUP and MEMBERSHIP before and controlling the
>>> auth_user.as well as company id in the group and membership/permission
>>> file.signifying what court the have jurisdiction to use. (Phew).
>>>
>>> I hope I haven't totally confused you.
>>>
>>> Thanks again ...
>>> *Ben Duncan*
>>> DBA / Chief Software Architect
>>> Mississippi State Supreme Court
>>> Electronic Filing Division
>>>
>>>
>>> On Thu, Dec 13, 2018 at 10:03 AM Anthony wrote:
>>>
 On Wednesday, December 12, 2018 at 6:57:07 PM UTC-5, Ben Duncan wrote:
>
> Yes, I wanted to just use the auth_table.
> Everything else is controlled outside of the normal mechs ..
>

 If you don't want to use the Auth login mechanism, then I suppose you
 can write your own logic. Keep in mind you will then be responsible for
 updating the session with the appropriate auth data so Auth knows the user
 is logged in on each subsequent request. But really, I don't see why you
 would do that just to avoid having the list of group memberships
 automatically updated upon login -- what problem is that creating for you?

 Anthony

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google
 Groups "web2py-users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group

Re: [web2py] lgoin_bare WTF???

2018-12-13 Thread Ben Duncan
Ok, thanks, will revisit it. I was getting insert errors from it before.
Maybe my ignorance ...


*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 13, 2018 at 2:14 PM Anthony  wrote:

> Got it, but I don't see login_bare/login_user/update_groups getting in the
> way of any of that. The update_groups method simply adds a dictionary of
> the user's current group ids/roles to the session, which can be used
> instead of doing a database lookup on each request. You are free to ignore
> it.
>
> Anthony
>
> On Thursday, December 13, 2018 at 11:34:05 AM UTC-5, Ben Duncan wrote:
>>
>> Thanks Anthony.
>>
>> I'm trying to maintain some reference to the auth mechanism , but our
>> needs get a little more convoluted.
>>
>> Some Background Info:
>> This is a accounting system (AR/AP/GL/IV/OE/PR/BI/BR/RMA/ ..etc) based
>> upon about 30 years of collected source
>> I have for Chancery / Circuit Clerks for Fees, Fines and restitution and
>> land records et.all.
>>
>> I'm trying to keep it generic as possible for the Supreme Court.
>>
>> From the Clerks view, the are elected officials for a particular
>> County/Jurisdiction. However, in some instances the may cover several
>> counties / courts (if those are small).
>>
>> Courts are grouped in "districts" and we are going to using "company id"
>> numbers to signify those courts within the districts and all courts under
>> one
>> umbrella for the database.
>>
>> Now the CLERKS have deputy clerks, who may OR may not be assigned to
>> multiple county/courts and may be limited to WHAT or what they cannot
>> do, but are designated by the "company" code to which court they will
>> have access to.
>> Add to that, the wants of our Office of the State Auditors our very own
>> AOC (Administrator of Courts and their auditors) it gets pretty
>> convulsed in a hurry.
>>
>> Now looking at the ACCESS CONTROL stuff, we are really a flipped version
>> of that - GROUP and MEMBERSHIP before and controlling the
>> auth_user.as well as company id in the group and membership/permission
>> file.signifying what court the have jurisdiction to use. (Phew).
>>
>> I hope I haven't totally confused you.
>>
>> Thanks again ...
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>>
>> On Thu, Dec 13, 2018 at 10:03 AM Anthony wrote:
>>
>>> On Wednesday, December 12, 2018 at 6:57:07 PM UTC-5, Ben Duncan wrote:

 Yes, I wanted to just use the auth_table.
 Everything else is controlled outside of the normal mechs ..

>>>
>>> If you don't want to use the Auth login mechanism, then I suppose you
>>> can write your own logic. Keep in mind you will then be responsible for
>>> updating the session with the appropriate auth data so Auth knows the user
>>> is logged in on each subsequent request. But really, I don't see why you
>>> would do that just to avoid having the list of group memberships
>>> automatically updated upon login -- what problem is that creating for you?
>>>
>>> Anthony
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] lgoin_bare WTF???

2018-12-13 Thread Anthony
Got it, but I don't see login_bare/login_user/update_groups getting in the 
way of any of that. The update_groups method simply adds a dictionary of 
the user's current group ids/roles to the session, which can be used 
instead of doing a database lookup on each request. You are free to ignore 
it.

Anthony

On Thursday, December 13, 2018 at 11:34:05 AM UTC-5, Ben Duncan wrote:
>
> Thanks Anthony.
>
> I'm trying to maintain some reference to the auth mechanism , but our 
> needs get a little more convoluted. 
>
> Some Background Info:
> This is a accounting system (AR/AP/GL/IV/OE/PR/BI/BR/RMA/ ..etc) based 
> upon about 30 years of collected source
> I have for Chancery / Circuit Clerks for Fees, Fines and restitution and 
> land records et.all.
>
> I'm trying to keep it generic as possible for the Supreme Court.
>
> From the Clerks view, the are elected officials for a particular 
> County/Jurisdiction. However, in some instances the may cover several
> counties / courts (if those are small).
>
> Courts are grouped in "districts" and we are going to using "company id" 
> numbers to signify those courts within the districts and all courts under 
> one
> umbrella for the database.
>
> Now the CLERKS have deputy clerks, who may OR may not be assigned to 
> multiple county/courts and may be limited to WHAT or what they cannot 
> do, but are designated by the "company" code to which court they will have 
> access to.
> Add to that, the wants of our Office of the State Auditors our very own 
> AOC (Administrator of Courts and their auditors) it gets pretty
> convulsed in a hurry.
>
> Now looking at the ACCESS CONTROL stuff, we are really a flipped version 
> of that - GROUP and MEMBERSHIP before and controlling the
> auth_user.as well as company id in the group and membership/permission 
> file.signifying what court the have jurisdiction to use. (Phew).
>
> I hope I haven't totally confused you.
>
> Thanks again ...
> *Ben Duncan*
> DBA / Chief Software Architect 
> Mississippi State Supreme Court
> Electronic Filing Division
>
>
> On Thu, Dec 13, 2018 at 10:03 AM Anthony wrote:
>
>> On Wednesday, December 12, 2018 at 6:57:07 PM UTC-5, Ben Duncan wrote:
>>>
>>> Yes, I wanted to just use the auth_table.
>>> Everything else is controlled outside of the normal mechs ..
>>>
>>
>> If you don't want to use the Auth login mechanism, then I suppose you can 
>> write your own logic. Keep in mind you will then be responsible for 
>> updating the session with the appropriate auth data so Auth knows the user 
>> is logged in on each subsequent request. But really, I don't see why you 
>> would do that just to avoid having the list of group memberships 
>> automatically updated upon login -- what problem is that creating for you?
>>
>> Anthony
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] lgoin_bare WTF???

2018-12-13 Thread Ben Duncan
Thanks Anthony.

I'm trying to maintain some reference to the auth mechanism , but our needs
get a little more convoluted.

Some Background Info:
This is a accounting system (AR/AP/GL/IV/OE/PR/BI/BR/RMA/ ..etc) based upon
about 30 years of collected source
I have for Chancery / Circuit Clerks for Fees, Fines and restitution and
land records et.all.

I'm trying to keep it generic as possible for the Supreme Court.

>From the Clerks view, the are elected officials for a particular
County/Jurisdiction. However, in some instances the may cover several
counties / courts (if those are small).

Courts are grouped in "districts" and we are going to using "company id"
numbers to signify those courts within the districts and all courts under
one
umbrella for the database.

Now the CLERKS have deputy clerks, who may OR may not be assigned to
multiple county/courts and may be limited to WHAT or what they cannot
do, but are designated by the "company" code to which court they will have
access to.
Add to that, the wants of our Office of the State Auditors our very own AOC
(Administrator of Courts and their auditors) it gets pretty
convulsed in a hurry.

Now looking at the ACCESS CONTROL stuff, we are really a flipped version of
that - GROUP and MEMBERSHIP before and controlling the
auth_user.as well as company id in the group and membership/permission
file.signifying what court the have jurisdiction to use. (Phew).

I hope I haven't totally confused you.

Thanks again ...
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Dec 13, 2018 at 10:03 AM Anthony  wrote:

> On Wednesday, December 12, 2018 at 6:57:07 PM UTC-5, Ben Duncan wrote:
>>
>> Yes, I wanted to just use the auth_table.
>> Everything else is controlled outside of the normal mechs ..
>>
>
> If you don't want to use the Auth login mechanism, then I suppose you can
> write your own logic. Keep in mind you will then be responsible for
> updating the session with the appropriate auth data so Auth knows the user
> is logged in on each subsequent request. But really, I don't see why you
> would do that just to avoid having the list of group memberships
> automatically updated upon login -- what problem is that creating for you?
>
> Anthony
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] lgoin_bare WTF???

2018-12-13 Thread Anthony
On Wednesday, December 12, 2018 at 6:57:07 PM UTC-5, Ben Duncan wrote:
>
> Yes, I wanted to just use the auth_table.
> Everything else is controlled outside of the normal mechs ..
>

If you don't want to use the Auth login mechanism, then I suppose you can 
write your own logic. Keep in mind you will then be responsible for 
updating the session with the appropriate auth data so Auth knows the user 
is logged in on each subsequent request. But really, I don't see why you 
would do that just to avoid having the list of group memberships 
automatically updated upon login -- what problem is that creating for you?

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] lgoin_bare WTF???

2018-12-12 Thread Ben Duncan
Yes, I wanted to just use the auth_table.
Everything else is controlled outside of the normal mechs ..

Thanks
*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Wed, Dec 12, 2018 at 4:09 PM Anthony  wrote:

> login_bare() is intended to log in the user without the unnecessary form
> processing of login(). Is there some reason you wouldn't what user_groups
> updated upon login? It is the list of auth groups of which the user is a
> member.
>
> Anthony
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] lgoin_bare WTF???

2018-12-12 Thread Anthony
login_bare() is intended to log in the user without the unnecessary form 
processing of login(). Is there some reason you wouldn't what user_groups 
updated upon login? It is the list of auth groups of which the user is a member.

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] lgoin_bare WTF???

2018-12-12 Thread Ben Duncan
 From the Manual:
Manual Authentication

Some times you want to implement your own logic and do "manual" user login.
This can also be done by calling the function:

1

user = auth.login_bare(username, password)

login_bare returns user if the user exists and the password is valid, else
it returns False. username is the email if the "auth_user" table does not
have a "username" field.
*-*
However, the code in login_bare goes about and does this:
if ((user.registration_key is None or not user.registration_key.strip())
   and  password == user[settings.passfield])):
self.login_user(user)
return user

Which is calling login_user, which is trying to do a self.update_groups()

My understanding of login_bare, is that all it is suppose to do is check
that the user exists in the auth_user file.

Is this not true ?

Thanks ...




*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.