Added team invitations - ref #893

As always, please tell me if there's something wrong or needing improvement, tests, etc.