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


#1

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();
  });
  
}

#2

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


#3

Thanks. I definitely need some coffee… :coffee: