auth.user_id

is defined as

if auth.user: auth.user_id = auth.user.id
else: auth.user_id = None


On Feb 13, 3:29 am, Niphlod <niph...@gmail.com> wrote:
> I think that auth.user_id in example needs to be auth.user.id .
>
> @pbreit: if you have a table like that and want to show to user "1"
> all the records with owner_id = 1, decorate the controller with
> @auth.requires_login() to make sure a registered user is logged.
> In the controller now you can access to auth.user.* that is all the
> data associated with the logged in user.
> auth.user.id is the id of that user.
>
> e.g. rows = db(db.detail.owner_id==auth.user.id).select()
>
> On Feb 12, 11:53 am, villas <villa...@gmail.com> wrote:
>
>
>
>
>
>
>
> > You can't give permissions to users,  only to groups.  Therefore the
> > only way to give permissions to a unique user is through their unique
> > group. The book gives an example where this is used in the section
> > Authorization and CRUD.
>
> > You don't need to use the inidividual user groups. I have never needed
> > to use them. Just turn them off and do your own thing:
> > auth.settings.create_user_groups = False
>
> > On Feb 12, 2:56 am, pbreit <pbreitenb...@gmail.com> wrote:
>
> > > I get the concept of groups which is why I was confused that web2py auth
> > > creates a auth_group.role for each individual user (user_1, user_2 and so
> > > on).
>
> > > In all of my apps I have just one class of users. Sometimes, only the
> > > created_by can view an item. And usually, only the create_by can edit an
> > > item. And on pretty much every page I have personalizations based on the
> > > logged in user. Almost every web site I can think of works like this.

Reply via email to