Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] Personal teams? #33

Open
shahzeb1 opened this issue Dec 6, 2024 · 2 comments
Open

[question] Personal teams? #33

shahzeb1 opened this issue Dec 6, 2024 · 2 comments
Labels
question Further information is requested

Comments

@shahzeb1
Copy link
Contributor

shahzeb1 commented Dec 6, 2024

Hi thank you for the package. This isn't an issue but rather a discussion question.

How should I think about a user's personal team? For instance, in most products (like Notion) a user signs up and has a "personal" project (or team). How can we assign items to a specific user (who is teamless)?

@Jurager
Copy link
Owner

Jurager commented Dec 6, 2024

Hi thank you for the package. This isn't an issue but rather a discussion question.

How should I think about a user's personal team? For instance, in most products (like Notion) a user signs up and has a "persona" project (or team). How can we assign items to a specific user (who is teamless)?

Hello! This is an interesting question. The core idea behind the approach I followed is to work with "teams," where it’s assumed that each user belongs to a team. All functionality is strictly tied to this concept.

That said, there are a couple of potential solutions:

  1. Automatically Create a Team at Registration

Upon user registration, a team can be created where the user is designated as the owner. This is currently implemented using the user_id key in the main team entity. No additional actions are required. If needed, you can restrict adding other users to this team or granting them permissions.

  1. Avoid Creating Teams Entirely

Alternatively, you can skip creating teams and instead bind the necessary entities directly to the user using custom logic. In this case, the package’s team-related functionality would be bypassed, and you’d need to manually handle all access rights.

If you have any other suggestions on how this issue could be resolved differently, I’m always open to new ideas and initiatives!

@Jurager Jurager added the question Further information is requested label Dec 6, 2024
@shahzeb1
Copy link
Contributor Author

shahzeb1 commented Dec 7, 2024

Thanks for the quick response! Option 1 (create a "Personal team" for the user) seems like better suggestion. This is based on the fact that if we have some arbitrary model (let's say Podcast) that can belong to either a User or a Team, then things will get hairy. Having to check permission depending on the type of owner model just seems like a recipe for accidental slipups.

From the Laravel Jeatstream docs:

Jetstream's team features allow each registered user to create and belong to multiple teams. By default, every registered user will belong to a "Personal" team. For example, if a user named "Sally Jones" creates a new account, they will be assigned to a team named "Sally's Team". After registration, the user may rename this team or create additional teams.

I think there's presidence set here by the benevolent gods of a first-party Laravel package, so maybe that is the "best" way. 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants