Every new registration is an anonymous action.
Same for all LDAP created users.
Those are the places that I can remember ad hoc. But they are likely to
stay in wicket.
Ldap was the situation where I tumbled accross it.

Sebastian
Am 08.02.2013 05:45 schrieb "Maxim Solodovnik" <[email protected]>:

> Maybe you are right,
> I just against anonymous updates.
> I believe it will be gone as soon as we will move to wicket. In fact all
> modifications are made by some user (except for initial import maybe)
>
>
> On Thu, Feb 7, 2013 at 2:22 PM, [email protected] <
> [email protected]
> > wrote:
>
> > I have changed it now to userId != null .. okay you changed it now
> already.
> > I think that will do its job for now.
> >
> > Sebastian
> >
> >
> > 2013/2/7 [email protected] <[email protected]>
> >
> > > In that sense I think the method
> > > IDataProviderDao.get(long id)
> > > should also be changed to
> > > IDataProviderDao.get(Long id)
> > >
> > > and in case id == null the method will return null.
> > > In that case we have this comparisson only at one place at least.
> > >
> > > Sebastian
> > >
> > >
> > > 2013/2/7 [email protected] <[email protected]>
> > >
> > > I don't understand that comparisson at all.
> > >> If you don't know which user is updating you should really set the id
> to
> > >> null.
> > >> so: entity.setUpdatedBy(null);
> > >> and not just ignoring that paramater. null is a valid value for a
> > >> OneToMany relation.
> > >> And no matter who the mapping are done, every entity that has a "Long
> > >> updatedby" or "User updatedby" is a "nullable" field.
> > >>
> > >> If anybody does a method call like:
> > >> entityXYZDao.update(entity,0)
> > >> That is simply wrong and will throw an exception cause a user with Id
> 0
> > >> does not exist. And that is also okay from my point of view.
> > >>
> > >> Where in our code do we actively use the paradigma/logic to set the
> > >> userId to 0?
> > >>
> > >> Sebastian
> > >>
> > >>
> > >> 2013/2/7 Maxim Solodovnik <[email protected]>
> > >>
> > >>> then you need to update code:
> > >>> if (userId > 0)
> > >>> to be
> > >>> if (userId != null)
> > >>>
> > >>> to avoid NPE
> > >>>
> > >>>
> > >>> On Thu, Feb 7, 2013 at 1:00 PM, [email protected] <
> > >>> [email protected]
> > >>> > wrote:
> > >>>
> > >>> > Sorry I don't understand it.
> > >>> > Maybe there might be a misunderstanding.
> > >>> >
> > >>> > Usermanagement has now a method:
> > >>> > usersDao.update(user, -1L);
> > >>> > -1L is for me almost same random as 1L. But -1L can never exist.
> Null
> > >>> would
> > >>> > make sense.
> > >>> >
> > >>> > I guess it might make sense to change the update method in the
> > >>> > IDataProviderDao to "Long userId" instead of "long userId" so that
> > you
> > >>> can
> > >>> > use "null" as userId. Same for the delete method in the
> > >>> IDataProviderDao.
> > >>> > That would actually solve all issue from my point of view.
> > >>> >
> > >>> > I have modified it just like that now.
> > >>> >
> > >>> > Sebastian
> > >>> >
> > >>> >
> > >>> > 2013/2/5 Maxim Solodovnik <[email protected]>
> > >>> >
> > >>> > > commited
> > >>> > >
> > >>> > >
> > >>> > > On Tue, Feb 5, 2013 at 3:55 PM, Maxim Solodovnik <
> > >>> [email protected]
> > >>> > > >wrote:
> > >>> > >
> > >>> > > > you are right :)
> > >>> > > > I'll update the DAOs to have anonymous updates :)
> > >>> > > >
> > >>> > > >
> > >>> > > > On Tue, Feb 5, 2013 at 3:50 PM, [email protected] <
> > >>> > > > [email protected]> wrote:
> > >>> > > >
> > >>> > > >> hehe
> > >>> > > >>
> > >>> > > >> what makes you think that
> > >>> > > >>
> > >>> > > >>     public void updateUser(User user) {
> > >>> > > >>         usersDao.update(user, 1l);
> > >>> > > >>     }
> > >>> > > >>
> > >>> > > >> is a good idea? Why not 2L or -1L or any other random number?
> > >>> > > >> I mean: What makes the user with the Id 1 so important that we
> > >>> will by
> > >>> > > >> default sign up every edit action to his account?
> > >>> > > >>
> > >>> > > >> null would make sense. But the update does not allow it. Thats
> > why
> > >>> > I've
> > >>> > > >> added one that has no userId param.
> > >>> > > >> When we use database generated indexes/sequencers the userId 1
> > >>> could
> > >>> > > >> someday not exist at all. So this hardcoded 1L makes me just
> not
> > >>> happy
> > >>> > > :)
> > >>> > > >>
> > >>> > > >> Sebastian
> > >>> > > >>
> > >>> > > >>
> > >>> > > >> 2013/2/5 <[email protected]>
> > >>> > > >>
> > >>> > > >> > Author: solomax
> > >>> > > >> > Date: Tue Feb  5 08:40:25 2013
> > >>> > > >> > New Revision: 1442500
> > >>> > > >> >
> > >>> > > >> > URL: http://svn.apache.org/viewvc?rev=1442500&view=rev
> > >>> > > >> > Log:
> > >>> > > >> > Code clean up: Copy/pasted method was removed
> > >>> > > >> >
> > >>> > > >> > Modified:
> > >>> > > >> >
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/Usermanagement.java
> > >>> > > >> >
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/dao/UsersDao.java
> > >>> > > >> >
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
> > >>> > > >> >
> > >>> > > >> > Modified:
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/Usermanagement.java
> > >>> > > >> > URL:
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/Usermanagement.java?rev=1442500&r1=1442499&r2=1442500&view=diff
> > >>> > > >> >
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> ==============================================================================
> > >>> > > >> > ---
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/Usermanagement.java
> > >>> > > >> > (original)
> > >>> > > >> > +++
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/Usermanagement.java
> > >>> > > >> > Tue Feb  5 08:40:25 2013
> > >>> > > >> > @@ -1549,7 +1549,7 @@ public class Usermanagement {
> > >>> > > >> >         }
> > >>> > > >> >
> > >>> > > >> >         public void updateUser(User user) {
> > >>> > > >> > -               usersDao.update(user);
> > >>> > > >> > +               usersDao.update(user, 1L);
> > >>> > > >> >         }
> > >>> > > >> >
> > >>> > > >> >         /**
> > >>> > > >> >
> > >>> > > >> > Modified:
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/dao/UsersDao.java
> > >>> > > >> > URL:
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/dao/UsersDao.java?rev=1442500&r1=1442499&r2=1442500&view=diff
> > >>> > > >> >
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> ==============================================================================
> > >>> > > >> > ---
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/dao/UsersDao.java
> > >>> > > >> > (original)
> > >>> > > >> > +++
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/data/user/dao/UsersDao.java
> > >>> > > >> > Tue Feb  5 08:40:25 2013
> > >>> > > >> > @@ -139,17 +139,6 @@ public class UsersDao implements
> IDataPr
> > >>> > > >> >                 return u;
> > >>> > > >> >         }
> > >>> > > >> >
> > >>> > > >> > -       public User update(User u) {
> > >>> > > >> > -               if (u.getUser_id() == null) {
> > >>> > > >> > -                       u.setStarttime(new Date());
> > >>> > > >> > -                       em.persist(u);
> > >>> > > >> > -               } else {
> > >>> > > >> > -                       u.setUpdatetime(new Date());
> > >>> > > >> > -                       u =     em.merge(u);
> > >>> > > >> > -               }
> > >>> > > >> > -               return u;
> > >>> > > >> > -       }
> > >>> > > >> > -
> > >>> > > >> >         public void delete(User u, long userId) {
> > >>> > > >> >                 deleteUserID(u.getUser_id());
> > >>> > > >> >         }
> > >>> > > >> >
> > >>> > > >> > Modified:
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
> > >>> > > >> > URL:
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java?rev=1442500&r1=1442499&r2=1442500&view=diff
> > >>> > > >> >
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> ==============================================================================
> > >>> > > >> > ---
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
> > >>> > > >> > (original)
> > >>> > > >> > +++
> > >>> > > >> >
> > >>> > > >>
> > >>> > >
> > >>> >
> > >>>
> >
> openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/ldap/LdapLoginManagement.java
> > >>> > > >> > Tue Feb  5 08:40:25 2013
> > >>> > > >> > @@ -726,7 +726,7 @@ public class LdapLoginManagement {
> > >>> > > >> >
> > >>> > > >> >                         User user = usersDao.get(newUserId);
> > >>> > > >> >                         user.setPictureuri(pictureUri);
> > >>> > > >> > -                       usersDao.update(user);
> > >>> > > >> > +                       usersDao.update(user, 1L);
> > >>> > > >> >
> > >>> > > >> >                 } catch (Exception e) {
> > >>> > > >> >                         log.error("Error creating user : " +
> > >>> > > >> > e.getMessage());
> > >>> > > >> >
> > >>> > > >> >
> > >>> > > >> >
> > >>> > > >>
> > >>> > > >>
> > >>> > > >> --
> > >>> > > >> Sebastian Wagner
> > >>> > > >> https://twitter.com/#!/dead_lock
> > >>> > > >> http://www.webbase-design.de
> > >>> > > >> http://www.wagner-sebastian.com
> > >>> > > >> [email protected]
> > >>> > > >>
> > >>> > > >
> > >>> > > >
> > >>> > > >
> > >>> > > > --
> > >>> > > > WBR
> > >>> > > > Maxim aka solomax
> > >>> > > >
> > >>> > >
> > >>> > >
> > >>> > >
> > >>> > > --
> > >>> > > WBR
> > >>> > > Maxim aka solomax
> > >>> > >
> > >>> >
> > >>> >
> > >>> >
> > >>> > --
> > >>> > Sebastian Wagner
> > >>> > https://twitter.com/#!/dead_lock
> > >>> > http://www.webbase-design.de
> > >>> > http://www.wagner-sebastian.com
> > >>> > [email protected]
> > >>> >
> > >>>
> > >>>
> > >>>
> > >>> --
> > >>> WBR
> > >>> Maxim aka solomax
> > >>>
> > >>
> > >>
> > >>
> > >> --
> > >> Sebastian Wagner
> > >> https://twitter.com/#!/dead_lock
> > >> http://www.webbase-design.de
> > >> http://www.wagner-sebastian.com
> > >> [email protected]
> > >>
> > >
> > >
> > >
> > > --
> > > Sebastian Wagner
> > > https://twitter.com/#!/dead_lock
> > > http://www.webbase-design.de
> > > http://www.wagner-sebastian.com
> > > [email protected]
> > >
> >
> >
> >
> > --
> > Sebastian Wagner
> > https://twitter.com/#!/dead_lock
> > http://www.webbase-design.de
> > http://www.wagner-sebastian.com
> > [email protected]
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>

Reply via email to