These are good changes but also change the behavior. the changes to 
mercurial.py now require multi-user mode and require the user to be logged 
in. In single user more the user can no loger commit.

If you can fix this problem, please email me a patch and I will be happy to 
include it.

massimo

On Wednesday, 12 December 2012 08:27:17 UTC-6, Jodi Curtis wrote:
>
> Hi
>
> I thought I'd post a response:
>
> change /web2py/applications/models/debug.py 
>
> @ line 3, replace if DEMO_MODE or MULTI_USER_MODE: with if DEMO_MODE:
>
> change /web2py/applications/models/mercurial.py 
>
> @ line 3, replace if DEMO_MODE or MULTI_USER_MODE: with if DEMO_MODE:
>
> @ line 9, insert If not auth.is_logged_in():
>
>     Session.flash = T("Sorry, login before committing changes")
>
>     Redirect(URL('default','design', args=request.args(0)))
>
>
> @ line 30 (now 32), replace lines 30 and 31 (now 32 and 33) with
>
> If not auth.user.email:
>
>     If not os.environ.get('HGUSER') and not uio.config("ui", "username"):
>
>         os.environ['HGUSER'] = 'web2py@localhost'
>
>     #this has no function due to the structure of the admin app, but 
> ideally this would be reset after setting the user
>
>     #if os.environ['HGUSER'] is not session/user specific, I do not know 
> enough about python or web2py at this point
>
>     #and this is good enough to get me going
>
>     #old_hguser = os.environ.get('HGUSER')
>
>
>     os.environ['HGUSER'] = auth.user.email
>
>
> change unknown file
>
> @?
>
>
>   #this would need to be called if resetting the os.environ['HGUSER'] is 
> needed after any commit, 
>
>   #so it cannot go in the same function, and the variable would need scope 
> outside of the function
>
>   #to be called within the commit function. 
>
>   #The
>
>   #structure means it cannot really be used without another global or 
> application level variable
>
>   #this for me demonstrated a fundamental flaw in the admin app, but I 
> don't have the experience
>
>   #in python, dynamic languages, or web2py to know for sure, I do think 
> refactoring the admin app and
>
>   #the integration with mercurial is a good long term option for better 
> encapsulation of, and execution
>
>   #of higher level functionality such as managing repositories, and 
> attributes associated with users.
>
>   #I guess sessions and requests can pass this too, but again the 
> structure of the app doesn't sit well with me
>
>   #so I am not going to make the changes necessary as I would end up 
> refactoring the whole app and I don't
>
>   #have the experience in python, web2py or the time to do that
>
>   os.environ['HGUSER'] - old_hguser
>
>
> change web2py/applications/admin/controllers/default.py
>
>
> @ line 220 insert 
>
>    #To add unique app names if users choose the same app names, and setup 
> the basis for branching and cloning
>
>    #of apps into new applications add the following
>
>    #branching or cloning needs to be implemented both in the admin app 
> creation too - not too hard, but also
>
>    #within the repository management, which is a bigger task (for me at 
> least) due to the structure of this element 
>
>    #of the app class
>
>    If auth.is_logged_in() and auth.user.username:
>
>       appname = '_'.join([appname,'test',auth.user.username])
>
>
>     #'test' may be better as tip/branch/clone or some other name, but 
> management must be done in step with
>
>     #the repository management for it to be aligned and make sense, so I 
> just chose test, to represent a hypothetical
>
>     #app clone on a test server - which is my setup.
>
>
> This code by me is very basic and low quality, it hasn't been extensively 
> tested without logged in users, and was
>
> tested using pam users, the email address might need to be added manually 
> after logging in for the first time.
>
>
> On Monday, December 10, 2012 7:39:16 PM UTC, Jodi Curtis wrote:
>>
>> Hi
>>
>> Recently I started to work with web2py
>>
>> After initially creating a password for the www_data user and using the 
>> admin login feature with no username or email request needed.
>>
>> All going well, I set about enabling PAM and MULTI_USER auth, so I could 
>> add PAM users to Linux and automatically have them be able to log in to 
>> web2py instances.
>>
>> After doing this I found my debug and versioning to act as if they were 
>> in demo mode despite this not being set.
>>
>> I wanted to add my user as a manager, I found next I couldn't then log in 
>> using the basic method as it is now using a different form - as I needed 
>> usernames for PAM, and there is no username for the created admin password 
>> account.
>>
>>
>> I am quite new to web2py and python, although have plenty of other 
>> programming experience, it is quite a major issue that once switching over 
>> to mod_pam I cannot enter the generic password to log in as an admin and 
>> enable is_manager, and seem to have some problem causing demo mode to 
>> activate disabling mercurial and debug with these three settings combined.
>>
>> If someone could offer some help it would be appreciated.
>>
>> I also then need to check a user is a member of a specific group before 
>> letting them on in a specific web2py instance (subdomain) along with 
>> checking if they are an admin user for is_manager, if someone can point me 
>> to some rough explained code on how to go about that, either in python or 
>> with web2py, I can probably figure the rest out myself, I'm finding the 
>> book very fragmented.
>>
>> Thanks
>>
>

-- 



Reply via email to