Special time/period and zone restrictions for certain accounts

Rosco Cooper6 years ago

Hello Anton,

I use a TK103-2 with my own Traccar server to let my family know where I am when I ride my bicycle. It's all working fine, thanks to your extensive documentation and support, incidentally - thanks!

But I have an additional need: every once in a while, I participate in bicycle tours, and I'd like to share my location and the routes I've taken with other people during a tour. But obviously I don't want random strangers to know where I've been before or after the tour, or figure out exactly where I live.

What I'd like is to create a special account that can only:

1/ view GPS positions within a certain time period (between the start date and the end date of a tour), both live and in reports
2/ view GPS positions only if they're outside a certain zone (say, outside of a 3 mile circle around my house), again both live and in reports

Looking extensively at the web interface options, I don't think it's possible to do either 1/ or 2/ without modifying the code. But I figured I'd ask before giving up. Any way to do what I want?

Thanks!
-Rosco

Anton Tananaev6 years ago

Unfortunately it's not possible at the moment.

Rosco Cooper6 years ago

Ok I thought so.
Thanks !

Anton Tananaev6 years ago

One option I can think about is to create a separate device just for the time of the tour and give other users access to it. Then switch back to your original device after. You can do it by modifying device unique id.

Rosco Cooper6 years ago

Yes that's pretty much what I do: I back up /opt/traccar, zap the database, restart Traccar, do the tour, then reinstall the old /opt/traccar. But I lose the routes I did during the tour.

Another option I'm thinking of is running another instance of Traccar, and code a small server sitting on another port to receive the packets from the tracker, and forward them to both Traccar server. My server could then do the filtering and only forward the packets that are within dates, and far enough away from a certain location, to the second server. It certainly wouldn't be very hard...

Anton Tananaev6 years ago

If you do what I suggested you won't lose the data. It's just be linked to two different devices.

Rosco Cooper6 years ago

Ah yes, I misunderstood you. Well, it might not be very convenient, as installing the TK103-2 in my bike was a rather complicated affair: my bike isn't really a bike, it's a velomobile:

Velomobile

Installing anything in a velomobile is always a bit of a chore. My tracker is deep inside the shell, and I'm not sure I want to spend an hour fishing it out each time I want to replace it.

But yeah, it's an option :)

Anton Tananaev6 years ago

I think you are still misunderstanding something. I am not suggesting to physically replace any devices.

Maybe an example will help you understand my suggestion.

  • Let's say you have a device "Bike" with unique id "12345"
  • You create a second device "Bike (tour)" with unique id "12345_"
  • For the duration of the tour swap unique ids for the devices
  • After the tour swap back

This way you have all your personal history under "Bike" and your tour history under "Bike (tour)". No data lost, no device replacements or anything. You can give users access to "Bike (tour)" to have access only for tour data.

Rosco Cooper6 years ago

Ooh now I got you. Clever!

Yeah I think I'll do that. And then I'll just try and remember to turn the tracker on and off a few miles away from my place, to avoid revealing the location of my house.

Thanks a lot for your help Anton!

Rosco Cooper6 years ago

Anton,

Sorry to bother you again.

I just noticed something else: my TK103-2 tracker reports the admin telephone number in its frames, and that is displayed in the device state tab (field "Number"). I tried to set no admin number in the device but it won't let me (it needs at least one apparently). And I can't set a bogus number either obviously, else it will stop answering SMS commands as soon as do.

Any way to mask the "Number" field, or zero it? I don't want everybody and their dog seeing my phone number.

If not, I think I'll be time to start diving in the code.

Anton Tananaev6 years ago

You can try to use computed attributed to change or remove it.

Rosco Cooper6 years ago

Ok that works - sort of: in my guest account, I set computed attribute number (lowercase n) to "0", type String. It doesn't show anything in the State tab rightaway, but it does overwrite the number at the next frame from the tracker.

What's strange is, it applies it to all the user accounts. Not that it bothers me, but that don't seem right.

What's even more strange is, now Traccar has started to apply my regular user's event notification to my admin account and vice-versa. That's a new one. Maybe overloading an attribute confuses the server or something...

Anyway, for now it works well enough.
Thanks!

EDIT: nevermind: I just realized event notifications and computed attributes in the device tab are linked to the devices, not the users. Duh...
So, it works fine :)

EDIT2: I wonder if I can apply the same technique (overwriting existing attributes with computed attributes) to achieve what I originally wanted: maybe by doing some math and tests on lat/long and time stamp, and modifying the lat/long, I can artificially "park" the device somewhere in the middle of the Atlantic when the time stamps are out of a certain time period, or when the device is too close to my house. Or set the Valid flag to No, so the frame is thrown out. Hmm, I'll play around with that...

Piotr6 years ago

I also try to share the location and the trail without access to history. I have the same problem.
The id number can be changed easily in the case of a smarfon application. How to do it for the gps tracker that uses the imei number?

Piotr6 years ago

I still can't do it.
How to add second device with new id if the device uses an imei number?
how to apply this suggestion Anton?

  • Let's say you have a device "Bike" with unique id "12345"
  • You create a second device "Bike (tour)" with unique id "12345_"
  • For the duration of the tour swap unique ids for the devices
  • After the tour swap back
Anton Tananaev6 years ago

What exactly is the problem with applying it? It works regardless of the id that your device uses.