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

feat: basic permission control #13

Merged
merged 17 commits into from
Sep 12, 2022
Merged

Conversation

exuanbo
Copy link
Contributor

@exuanbo exuanbo commented Sep 8, 2022

No description provided.

src/types.ts Outdated Show resolved Hide resolved
@himself65 himself65 mentioned this pull request Sep 9, 2022
5 tasks
@exuanbo exuanbo changed the title [WIP] feat: basic permission control feat: basic permission control Sep 12, 2022
@exuanbo exuanbo marked this pull request as ready for review September 12, 2022 15:02
@exuanbo
Copy link
Contributor Author

exuanbo commented Sep 12, 2022

What do you think about this API design?

/cc @himself65

src/server/socket/index.ts Outdated Show resolved Hide resolved
src/events.ts Show resolved Hide resolved
Copy link
Contributor

@himself65 himself65 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a logic issue.

If an owner closes a room, others could open it again with the same id and data. This caused the original owner to become a user. But we could fix it in the future.

@himself65 himself65 merged commit 7a891d5 into TexteaInc:main Sep 12, 2022
@exuanbo
Copy link
Contributor Author

exuanbo commented Sep 12, 2022

There's a logic issue.

If an owner closes a room, others could open it again with the same id and data. This caused the original owner to become a user. But we could fix it in the future.

I've considered this issue. It will only happen when the server is created with option autoDeleteRoom (default to false).

I enabled this option in the example because it's easier to test.

const io = createSocketIOServer<ClientData>(httpServer, {
autoDeleteRoom: process.env.NODE_ENV === 'development'
})

And currently the room data (owner etc.) is stored in memory by roomMap, in the future it will be better to provide a way to store the data in external database or something.

@exuanbo exuanbo deleted the permission-control branch September 14, 2022 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants