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

Added OnvifLoginCheck to system #178

Merged
merged 3 commits into from Jul 24, 2021

Conversation

Slyke
Copy link

@Slyke Slyke commented Jul 13, 2021

Adding the ability to turn off OnvifLoginCheck. This allows other accounts to use Onvif functionality. currently only the admin account can.

Details are in this thread: https://amcrest.com/forum/ip-cameras-f18/ip3m-941b-onvif-and-user-management-t12647-s20.html

ret = self.command(
"configManager.cgi?action=setConfig&UserGlobal.OnvifLoginCheck=false"
)
return ret.content.decode('utf-8')

Choose a reason for hiding this comment

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

no newline at end of file

)
else:
ret = self.command(
"configManager.cgi?action=setConfig&UserGlobal.OnvifLoginCheck=false"

Choose a reason for hiding this comment

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

line too long (85 > 79 characters)

def onvif_login_check(self, setCheck=False):
if setCheck == True:
ret = self.command(
"configManager.cgi?action=setConfig&UserGlobal.OnvifLoginCheck=true"

Choose a reason for hiding this comment

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

line too long (84 > 79 characters)

@@ -165,3 +165,14 @@ def reboot(self, delay=None):

ret = self.command(cmd)
return ret.content.decode('utf-8')

def onvif_login_check(self, setCheck=False):
if setCheck == True:

Choose a reason for hiding this comment

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

comparison to True should be 'if cond is True:' or 'if cond:'

Copy link
Owner

@tchellomello tchellomello left a comment

Choose a reason for hiding this comment

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

@Slyke how about this?

    def onvif_login_check(self, setCheck=False):
        """DOC HERE """
        cmd = 'configManager.cgi?action=setConfig'
        cmd += "&UserGlobal.OnvifLoginCheck={0}".format(str(setCheck))
        ret = self.command(cmd)

"""
cmd = 'configManager.cgi?action=setConfig'
cmd += "&UserGlobal.OnvifLoginCheck={0}".format(str(setCheck))
ret = self.command(cmd)

Choose a reason for hiding this comment

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

local variable 'ret' is assigned to but never used

@Slyke
Copy link
Author

Slyke commented Jul 24, 2021

@tchellomello works for me! Updated master and merged the fixes on my fork.

Note the .lower() in format()


    def onvif_login_check(self, setCheck=False):
        """
        Allows the other non-admin accounts to use ONVIF.
        Currently only the 'admin' account can use ONVIF.
        """
        cmd = 'configManager.cgi?action=setConfig'
        cmd += "&UserGlobal.OnvifLoginCheck={0}".format(str(setCheck).lower())
        ret = self.command(cmd)

        return ret.content.decode()

@flacjacket
Copy link
Collaborator

Looks good, thanks!

@flacjacket flacjacket merged commit f92acf8 into tchellomello:master Jul 24, 2021
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

4 participants