Publishing should be done based on user authentication, not knowing the DB credentials. A request to publish should be sent to the server. If a user has access, the application itself should the right commands to publish