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

[telegram] allow access restrictions on chat ids #7857

Merged
merged 3 commits into from
Jun 6, 2020

Conversation

J-N-K
Copy link
Member

@J-N-K J-N-K commented Jun 4, 2020

Adds the ability to use access modifiers on chat is. Use-case: Some chat ids (e.g. children) should receive notifications but should not be allowed to send commands.

Fully backward compatible, no modifier = sending and receiving

Signed-off-by: Jan N. Klug [email protected]

@J-N-K J-N-K added the enhancement An enhancement or new feature for an existing add-on label Jun 4, 2020
@J-N-K J-N-K requested a review from ZzetT as a code owner June 4, 2020 19:29
Signed-off-by: Jan N. Klug <[email protected]>
Copy link
Contributor

@cweitkamp cweitkamp left a comment

Choose a reason for hiding this comment

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

Thanks. One remark.

chatIds.add(Long.valueOf(chatIdStr));
if (chatIdStr.trim().startsWith("<")) {
// inbound only
authorizedSenderChatId.add(Long.valueOf(chatIdStr.substring(1)));
Copy link
Contributor

Choose a reason for hiding this comment

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

If you trim() earlier it is not a good idea to use substring(1) on the not trimmed String. Maybe introduced a local variable for the `trimmedChatId and use it here and in the following lines.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point.Done.

Signed-off-by: Jan N. Klug <[email protected]>
@TravisBuddy
Copy link

Travis tests were successful

Hey @J-N-K,
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.

@openhab openhab deleted a comment from TravisBuddy Jun 6, 2020
@openhab openhab deleted a comment from TravisBuddy Jun 6, 2020
Copy link
Contributor

@cweitkamp cweitkamp left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

@cweitkamp cweitkamp added this to the 2.5.6 milestone Jun 6, 2020
@cweitkamp cweitkamp merged commit 3eeb6a5 into openhab:2.5.x Jun 6, 2020
@J-N-K J-N-K deleted the telegram branch June 6, 2020 08:25
CSchlipp pushed a commit to CSchlipp/openhab-addons that referenced this pull request Jul 26, 2020
* allow access restrictions on chat ids

Signed-off-by: Jan N. Klug <[email protected]>
Signed-off-by: CSchlipp <[email protected]>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* allow access restrictions on chat ids

Signed-off-by: Jan N. Klug <[email protected]>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* allow access restrictions on chat ids

Signed-off-by: Jan N. Klug <[email protected]>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* allow access restrictions on chat ids

Signed-off-by: Jan N. Klug <[email protected]>
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Aug 31, 2020
* allow access restrictions on chat ids

Signed-off-by: Jan N. Klug <[email protected]>
DaanMeijer pushed a commit to DaanMeijer/openhab-addons that referenced this pull request Sep 1, 2020
* allow access restrictions on chat ids

Signed-off-by: Jan N. Klug <[email protected]>
Signed-off-by: Daan Meijer <[email protected]>
markus7017 pushed a commit to markus7017/openhab-addons that referenced this pull request Sep 19, 2020
* allow access restrictions on chat ids

Signed-off-by: Jan N. Klug <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants