Is it a bad practice to use publication to access this.userId on server?

I need to set Accounts.config individually for each user. So when client connects to server I need to set configs using data from User document.
Does anybody knows a better way? Method needs to be called so I thought that publication is better.

if (Meteor.isServer) {

  Meteor.publish(null, function () {
    if (this.userId) {
      Accounts.config({ 
        loginExpirationInDays: Meteor.users.findOne(this.userId).loginExpirationInDays
      });
    }

    this.ready();
  });
  
}

this doesn’t make sense
if loginExpirationInDays is a global configuration, then everytime you change it all users are affected by the last change

2 Likes

Thanks. I definitely need some coffee… :coffee:

1 Like