Skip to content

property won't set if it is read only.#156

Open
fatmehosseini wants to merge 2 commits into
WebThingsIO:masterfrom
fatmehosseini:applyReadOnly
Open

property won't set if it is read only.#156
fatmehosseini wants to merge 2 commits into
WebThingsIO:masterfrom
fatmehosseini:applyReadOnly

Conversation

@fatmehosseini

Copy link
Copy Markdown

Hi,
I noticed that read only parameter is not used. If a user put value to a read only property it will be accepted.
Also about integer and number properties if the put property be less than minimum or more than maximum the server wouldn't care and accept the new value for the property.
I made some changes to prevent accept new value in mentioned case.

Comment thread Thing.h Outdated
}
bool isInRange(ThingDataValue value){
return (this->maximum < this->minimum) //to check if minimum and maximum values are asigned
|| (this->maximum > value.)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why dot in value. ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

where is isInRange used ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sorry, at first I was going to handle the process of validation the range in a function then decide to do it directly but forget to delete the function. this function is not used and should delete.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

should I just create another pull request?

@rzr

rzr commented Jun 23, 2023

Copy link
Copy Markdown
Collaborator

It looks like commit message and code differ

@rzr

rzr commented Jun 23, 2023

Copy link
Copy Markdown
Collaborator

@rzr

rzr commented Jun 24, 2023

Copy link
Copy Markdown
Collaborator

what about read only test ?

@fatmehosseini

Copy link
Copy Markdown
Author

what about read only test ?
in thing.h file in line 585 and 856 in setProperty() function it will be checked.

Comment thread Thing.h
void setProperty(const char *name, const JsonVariant &newValue) {
ThingProperty *property = findProperty(name);

if(property->readOnly)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

good!

@rzr

rzr commented Jun 28, 2023

Copy link
Copy Markdown
Collaborator

@rzr

rzr commented Jun 11, 2025

Copy link
Copy Markdown
Collaborator

Is anyone interested to take over this work ?

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.

2 participants