Doesn't zend openid auto clean nonce files? - zend-framework

I am using zend OpenID library:https://github.com/marcinwol/zfopenid works great. But, the issue is not cleaning tmp folder files[nonce files]. It seems purgeNonces members of Zend_OpenId_Consumer_Storage_File are
not being called anywhere in the execution. http://framework.zend.com/manual/1.11/en/zend.openid.consumer.html dbstorage seems to clear the expired data. But, that too is not clearing Nonce. I am planning to use dbstorage. Any examples would be appreciated.
Thanks
I found some info, we do not need to delete discovery files as it is for single id.
http://openid.net/specs/openid-authentication-2_0.html#verify_nonce
as per this, Zend_OpenId_Consumer_Storage_File doesn't delete nonce files. Whenever we want to call purgeNonce, we must use
"The time-stamp MAY be used to reject responses that are too far away from the current time".so I can delete old nonce files.
Also, dbstorage example's isUniqueNonce has to check for a duplicate nonce for the same OP, Not for all OP.
please correct my understanding if it is wrong.

Related

Setting a value in Frappe application isn't reflected in ERPNext GUI

I have added a 'number_of_members' value to the Customer DocType via customization.
In my application I have tried several ways to update the value. However the value never updates in the webpage. I feel like I'm missing some sort of save or update or commit step.
For example I have tried:
frappe.client.set_value('Customer', '00042', 'number_of_members', 8887)
frappe.set_value('Customer', '00042', 'number_of_members', 8887)
frappe.db.set_value('Customer', '00042', 'number_of_members', 8887)
and also
customer = frappe.get_doc('Customer', '00042')
customer.number_of_members = 8887
customer.save()
In each case I can do something like frappe.get_value, or frappe.get_doc and it shows the value is set to 8887. However it never updates in the web side. This is what makes me think I'm updating some sort of cache or database transaction and I need some way to save it, but have not had any luck.
I am mostly testing this via bench console if that has any bearing on it, but I've tried a couple of the methods in my application code as well.
Relevant documentation:
Frappe Developer API - Document
Frappe Developer API - Database
Turns out the answer is to call frappe.db.commit() after making changes. If someone can point this out in the documentation so I can better understand how I'm missing stuff, I would appreciate it.
I also noticed if you try to Save something in the UI before you send frappe.db.commit() the UI will hang.

How can I actually download/transfer a file found using UPnP?

I'm completely new to UPnP as a protocol, but I'm hoping to use it to transfer files from a Sony Camera to an iOS app I'm working on. So far I have SSDP discovery setup, I can read the UPnP client's services, search through folders and access file names, but the final hurdle which I'm stuck on is how to actually download/transfer the files once I'm able to list them!
What I end up getting is the below:
<item id="04_02_0624600856_000001_000001_000000" restricted="1" parentID="03_01_0624600856_000001_000000_000000">
<dc:title>DSC05076.ARW</dc:title>
<upnp:class>object.item.imageItem.photo</upnp:class>
<dc:date>2018-08-23T12:24:21</dc:date>
<res protocolInfo="http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_SM;DLNA.ORG_CI=1">http://192.168.122.1:60151/SM_DSC05076.ARW?%2104%5f02%5f0624600856%5f000001%5f000001%5f000000%21http%2dget%3a%2a%3aimage%2fjpeg%3aDLNA%2eORG%5fPN%3dJPEG%5fSM%3bDLNA%2eORG%5fCI%3d1%21%21%21%21%21</res>
<res protocolInfo="http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_LRG;DLNA.ORG_CI=1">http://192.168.122.1:60151/LRG_DSC05076.ARW?%2104%5f02%5f0624600856%5f000001%5f000001%5f000000%21http%2dget%3a%2a%3aimage%2fjpeg%3aDLNA%2eORG%5fPN%3dJPEG%5fLRG%3bDLNA%2eORG%5fCI%3d1%21%21%21%21%21</res>
<res protocolInfo="http-get:*:image/jpeg:DLNA.ORG_PN=JPEG_TN;DLNA.ORG_CI=1">http://192.168.122.1:60151/TN_DSC05076.ARW?%2104%5f02%5f0624600856%5f000001%5f000001%5f000000%21http%2dget%3a%2a%3aimage%2fjpeg%3aDLNA%2eORG%5fPN%3dJPEG%5fTN%3bDLNA%2eORG%5fCI%3d1%21%21%21%21%21</res>
I would (With my naive experience of simple HTTP APIs) then expect to simply be able to download the file in question by hitting:
http://192.168.122.1:60151/SM_DSC05076.ARW or similar (I'm assuming I have to change this URL slightly as the file is listed as image/jpeg rather than RAW?
Whatever combination I try of the full res object, snipping bits, decoding the url e.t.c. I always get a 404 response when trying to visit the URL in question. Is there something more complex I need to do here? Or something simple that I'm missing?
Thanks in advance!
The problem here was that I was using a url from a previous session. It turns out that the urls change between connection sessions, which is why I was getting a 404.
Lesson learned: UPnP is highly dynamic, and you can’t rely on caching images under their access MRL!

Send metadata with GCS signed url

Is it possible to set custom metadata to a file using when writing to a signed url? I tried adding a 'x-goog-meta-mything' but it didn't work.
I'm using the node client lib.
Update to be clearer:
Setting the header doesn't seem to be an issue, but when creating the signed URL I have to know the value of the meta-data ahead of time, which isn't useful. I.E. I have x-goog-meta-deltachanges and it could be a number any where between 1 and many thousands. In my signedUrl I have to set x-goog-meta-deltachanges:1,2,3,4,5,6... and it doesn't seem like a good idea.
As far as the Signed URLs docs go, it should be.
Have you set the Canonical extension headers bit as needed?
I mean, you need to both include the x-goog-meta-mything:VALUE in the StringToSign, and you need to then send the same x-goog-meta-mything:VALUE header in the PUT request.
Have you done this, is it not working?

Clone rep:policy on AEM

I am currently working on with a solution that would be able to clone/copy/backup my existing rep:policy. 'Cause when we do some jobs it accidentally removed. I am trying to apply this kind of fix, but am failing to. It says it is an invalid path.
javax.jcr.security.AccessControlException: OakAccessControl0006: Isolated policy node. Parent is not of type [rep:AccessControllable]
final Workspace ws = session.getWorkspace();
ws.copy("/etc/commerce/products/abccompany/TvPackChannelMap/rep:policy","/tmp/nxt/TvPackChannelMap/rep:policy");
Are there other ways that I can be able to take the rep:policy thru code?
You need to make sure that your job does not touch the permissions or the rep:policy, this is the best way forward for you.
The exception could be because of /etc/commerce/products/abccompany/TvPackChannelMap/rep:policy does not exist or the user whose session you are using does not have read access to the node.
Make sure the path is correct, copy paste it to your CRX/DE to make sure it exists.
I have tried to use your code to copy a rep:policy from one node to another, works fine. But I would not* recommend copying permissions that way. The best practice is to use the Access Control Management API for all things permissions.
You can check, install and use the access control tool from netcentric. It offers a jmx interface for exporting AC entries and maybe also some APIs you could use to implement your custom solution.
The Other approach is to retrieve the ACL permissions through the query language.
For example, SELECT * FROM [rep:ACL] or SELECT * FROM [rep:ACE] where [rep:principalName] is not null should give you the results.
For more information, I would recommend you to check the ACS commons ACL Packager Implementation which is available on GitHub.
Reference Link - https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/main/java/com/adobe/acs/commons/packaging/impl/ACLPackagerServletImpl.java

cocos2d-x zlib support is missing crypt.c

I just noticed that the zlib_support in cocos2d-x is missing crypt.c
I was able to update the code and add crypt.h from
http://programming-practice.googlecode.com/svn/trunk/LevelUp/cocos2d-x/cocos2d-1.0.1-x-0.11.0/cocos2dx/platform/third_party/marmalade/zlib/contrib/minizip/crypt.h
to the project to get it working but I would like to know why this functionality is removed from the framework in the first place? Is there an alternative to the crypt.h I have used?
I finally found out the reason.
When you go on to publish your app, you are required to disclose if you are using encryption or not. And if your answer is yes, then there are separate and significantly longer process of approval. Adding encryption into cocos2d-x would therefore result in long approval times for a large number of apps. Hence it's not included.
http://cheminf20.org/2011/08/29/releasing-an-ios-app-using-encryption-first-time/