AS3: Get name of computer login - actionscript-3

Just a quick question, I googled around for a bit but everything resulted in other AS3 tidbits.
Is it at all possible to access a user's computer logon name from AS3? I wouldn't have assumed so but given we can access other information directly from the computer (eg date), I just wondered if it was possible.
Thanks!
Harry.

On the web, I believe you can't get such an info.
If you are working on the desktop with AIR, you may retrieve the user's directory with
File.userDirectory
and its name which should be the same as the user's
File.userDirectory.name

I'd love to know the login of the user, but also his password.
I think it's not desirable to be able to get such information, especially from a client-side script. This is possible with ASP.NET using Windows Authentication. When the user is authenticated you can use User.Identity.Name. It should be possible to write that name to the front-end, and you can pass that to Flash using ExternalInterFace
If you are using Adobe Air, it is easier to grab the users name, since you have access to the users filesystem. See Get the current logged in OS user in Adobe Air.
Btw, on the web, it is not an unusual question to ask the user what his (user)name is.

Related

ActionScript class to get unique system id

Is there a way to get a unique system id using ActionScript?
I found this answer but it appear to be all C++
get unique machine id
Anyway, I am looking for a deterrent for copying our Flash App. It will be installed on a select number of kiosk in stores. Anything outside of that we want the client to come back to us.
It doesn't have to be rock solid just an annoyance.
My thinking is that we would define a list of system IDs in code and just do a simple compare.
You can get the machine's MAC address if you are using AIR:
read MAC address of machine from Adobe AIR
Also:
NetworkInterface docs

AIR 3.5 Mobile project device ID

I am wondering if someone knows the best method for storing data in a global DB against a mobile device (iOS and Android)?
I am building an app that writes/retrieves information based on a query however I need to know if any of the records returned were sent from that device.
Basically the idea is that if a user submits some information (which is stored in the DB) they gain access to additional features of the app. When the app is launched, I will check the DB to see if they submitted information in the past and allow access to other areas.
I use local storage for the information they submitted but also store remotely so if the local storage becomes corrupted for any reason there is still a record of the information the user submitted.
The ID needs to be unique to the device as there could be 100 of users (hoping for millions) so the ID needs to be unique enough that it will never conflict with another device. Any information submitted will be available for retrieval by all other users.
Thanks :)
There are three options as I see it:
1. User
You can create a typical username + password user scheme and use this to verify the user. A possible advantage of this method would be that the user can log in from any of their devices (for instance, under your method a user using the app from their iPhone and iPad would have two different views - which you may not want). Of course, this means forcing every user of the app to register within your system, which is not ideal.
2. App Install
You can uniquely identify an app install by having your app generate a UUID the first time that the app is run (you can use an AS3 helper library to generate the UUID). You can store this UUID locally and send it along with every request the app makes. The downside to this approach is that it doesn't uniquely identify the device - only a specific app install. For instance, if the user deletes the app and then reinstalls it at a later point, it will now count as a new unique device, even though the user is on the same device.
3. Device
AIR does not have a built-in way of reading device identifying info. However, you can retrieve device info through AIR Native Extensions, for example this one can get the MAC address and some other things. There are privacy concerns and other issues involved in reading and storing device info such as these, so you are probably best served trying to implement the OpenUDID project as an AIR Native Extension, since they have already dealt with all such issues. Unfortunately, I have never looked too far into developing ANE's so I am not sure how complicated or feasible it will be to turn OpenUDID into an ANE.
Summary: I would recommend the app install method due to the ease of implementation. If you really need the unique device and are worried about the multiple app installs case, you will have to work out how to use native extensions to get the info you need. If you decide that you would rather identify by user rather than device, use the user method.
As of now I don't think its possible to get the hardware devices guid using air mobile. However you do have a couple of options.
If the MAC address is good enough for you there is an ANE that will let you grab it on both iOS and Android.
http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/networkinfo.html
and an example of how to use it
http://cookbooks.adobe.com/post_Getting_NetworkInfo_from_both_Android_and_iOS-19473.html
You could also write your own ANE, it should be pretty simple to wrap both Android and iOS implementations.
Objective-c: [[UIDevice currentDevice] uniqueIdentifier]
Android: TelephonyManager.getDeviceId()
If your app requires any kind of user account or login the best option would be to store this setting in the remote db.

Access Control and Cache Manifest for Offline Use

I would like to gather some feedback on how best to handle access control within a web application that has a requirement for offline use.
The app must have access control via username/password but must be available for offline use. That means that the first time the user logs in, the user must have an internet connection. Once logged in the app will set an acl cookie followed by caching all assets through cache manifest.
Is this a solid approach and what other methods have you used to solve this issue?
Thank you in advance for all your feedback.
Answering quite late but even if you no longer need it someone else will...
Once offline, you need to store all access info on the device. It will be accessible by third parties so there will be a matter of time before someone will have access to all your app content. I explain to clients that once you publish something for offline use, it's there for anyone to see. You can implement some basic login but unless you use an online service, it's not going to be any secure...
Giving that, use local storage to keep track of initial login. Then, refresh it every so often when device goes online.

BlackBerry Location Support

I've seen the posts about requiring a signing code in order to access location functionality in BlackBerry (http://stackoverflow.com/questions/2876050/blackberry-location-api-not-working-correctly) but is this required even for a website? I too am getting 0 for both latitude and longitude... but signing codes appear to be for native apps, not websites. I would really appreciate any tips. Thanks!
The location API does not need code signing in order to access, but location data is considered priviledged and the application will need user permission to access it. There is also a system to allow the user to authorize websites to access location data but I`m not very familiar with it.
I talked to my boss who actually uses JS access to the blackberry location. He just followed the documentation here. Though he did say that before I upgraded him to a 9000 running OS 5.0 it was a bit hit and miss. The only other advice he had was it is slow and you have to wait for it.

Accessing system resources through a web page

Is it possible to access system resources via a web page?
Specifically I would be interested in accessing system calls in order to put the computer into standby or sleep.
At this point, I am language-independent. I would imagine that some sort of special access would need to be granted before anything of this nature occurs. My searches haven't really returned much help, so any suggestions would be great.
Yes, it is possible. See for example the online antiviruses.
I haven't done such thing but java applets can achieve that, also some kind of ActiveX controls. Of course user permission is required.