How to set a specific rules in firebase realtime? - firebase-realtime-database

I would like to put my rules in the database so that some tables can only be written by the admin. I'm having trouble with this :( could someone help me?
Inside my user table I have an "admin" field: true.
I would like the "users" and "Vinyls" tables to be modified only by the admin.
At the moment I have set the following rules, but doing so I cannot modify the vinyls table.
{
"rules": {
"users": {
".read":"root.child('users').child('uid').val()===auth.id",
".write":"root.child('users').child('uid').val()===auth.id"
},
"Vinyls":{
".read":"root.child('users').child('uid').val()===auth.id",
".write":"root.child('users').child(auth.id).child('admin').val()=='true'"
},
"WishList":{
".read":"root.child('users').child('uid').val()===auth.id",
".write":"root.child('users').child('uid').val()===auth.id"
},
"RatingUsersVinyls":{
".read":"root.child('users').child('uid').val()===auth.id",
".write":"root.child('users').child('uid').val()===auth.id"
}
}
}
users table:
{
"users": {
"Qi8HU8YFMLhKhvoiHLkR6ooqnOp2": {
"admin": true,
"email": "admin#gmail.com",
"name": "Admin",
"password": "admin123",
"surname": "Admin Surname"
},
"rTEp7K1cE8W4pZF9diB09ZxWfC72": {
"admin": false,
"email": "testUser#hotmail.it",
"name": "User",
"password": "test123",
"surname": "Test"
}
}
}
Vinyls table:
"Vinyls": {
"v1": {
"author": "Pink Floyd",
"description": "A1 In The Flesh? , A2 The Thin Ice, A3 Another Brick In The Wall Part 1, A4 The Happiest Days Of Our Lives, A5 Another Brick In The Wall Part 2, A6\tMother, B1 Goodbye Blue Sky, B2 Empty Spaces, B3 Young Lust, B4\tOne Of My Turns, B5 Don't Leave Me Now, B6 Another Brick In The Wall Part 3,B7\t Goodbye Cruel World, C1\tHey You,C2\tIs There Anybody Out There?, C3 Nobody Home,C4 Vera,C5 Bring The Boys Back Home,C6 Comfortably Numb,D1 The Show Must Go On,D2 In The Flesh,D3\tRun Like Hell,D4 Waiting For The Worms,D5\tStop,D6\tThe Trial,D7\tOutside The Wall",
"genre": "rock",
"imgSrc": "https://i.discogs.com/L_VyYyJq5qz9dKeMRuRSGg3ftbl-sadWu4oaJotdn-M/rs:fit/g:sm/q:90/h:600/w:588/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTIwNDE2/MTgtMTM5MDY3OTAy/NS0yMzcyLmpwZWc.jpeg",
"name": "The Wall",
"price": "20",
"youtubeLink": "https://www.youtube.com/playlist?list=OLAK5uy_nE3dmeYl_9Jgv2CT0aqufkDcyB6BBMcGM"
},
"v2": {
"author": "Tresor",
"description": "E1 –Joey Beltram Ball Park (DJ Rush First Bass Mix), E2 –Joey Beltram Game Form (Mike Dearborn Remix),F1 –3 Phase Feat. Dr.,F2 –Ingator Skyscratch (Mano Mano),G1 –K.Hand* Mystery,G2 –Marshall Jefferson Floating,H1 –3MB Feat. Juan Atkins Die Kosmischen Kuriere,H2 –Eddie Flashin' Fowlkes* & Blake Baxter Wisdom",
"genre": "TechnoX",
"imgSrc": "https://i.discogs.com/gpDw1iNqHNRbzb3M_z6unHWMc_T2nnx4SoiymIuu02Y/rs:fit/g:sm/q:40/h:300/w:300/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTMyMjk0/LTEyNTUzMDEwNjgu/anBlZw.jpeg",
"name": "Various ‎– True Spirit. Part II",
"price": "25",
"youtubeLink": "https://youtu.be/kyYOk-irg_Y"
},
"v3": {
"author": "The Hacker",
"description": "A1 Propagande, A2 Still ,B1 La Marine ,B2 Propagande V2",
"genre": "Electro, House, Techno",
"imgSrc": "https://i.discogs.com/IltPMOL6d_JFSF4mT-U9SkZ5WyJ2WERAfp4UXAq4lLU/rs:fit/g:sm/q:40/h:300/w:300/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTEwNDAz/Nzk0LTE0OTY3NTg5/NDMtNDQ5Ny5wbmc.jpeg",
"name": "Propagande EP",
"price": "67",
"youtubeLink": "https://youtu.be/QQRBdMQEMDM"
},
"v4": {
"author": "Dettmann* | Klock*",
"description": "A1 Phantom Studies ,B1 No One Around ,B2 The Room ,C1 Prophet Man ,C2 Bad Boy ,D1 The World Tonight ,D2 The Tenant",
"genre": "Techno",
"imgSrc": "https://i.discogs.com/jPsplJDJJjZ0U1ZANW-1DFiyorKAjzy01cS7QFqgo9I/rs:fit/g:sm/q:90/h:600/w:600/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTk2NDE4/NjUtMTQ4NDA3NjM1/OS00MDIwLmpwZWc.jpeg",
"name": "Phantom Studies",
"price": "55",
"youtubeLink": "https://youtu.be/dsiZO6oAekE"
},
"v5": {
"author": "Adiel",
"description": "A1 Method ,A2 Mad ,B1 Time Is Out ,B2 In Your Power",
"genre": "Techno",
"imgSrc": "https://i.discogs.com/9gKf_bXz5gLn4peUqdeQi3WS9Vmie82tM7cAUB1o-ks/rs:fit/g:sm/q:40/h:300/w:300/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTE4OTE0/NTM2LTE2MjIxOTA1/NDMtMTk3NS5qcGVn.jpeg",
"name": "Method EP",
"price": "20",
"youtubeLink": "https://youtu.be/-Hgk_LgZ5lw"
},
"v6": {
"author": "Fadi Mohem",
"description": "A1 Moving On ,A2 Reinforced ,B1 RS-290 ,B2 Horus",
"genre": "Techno",
"imgSrc": "https://i.discogs.com/O5BE45prwmh1Xm3KBeJEizPLQeLqjI2MR6tAc-hANCU/rs:fit/g:sm/q:40/h:300/w:300/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTEyMjgx/NDg5LTE2MzU0MzEy/NTItMTUwNC5qcGVn.jpeg",
"name": "Reinforced",
"price": "35",
"youtubeLink": "https://youtu.be/Se2lDHsffUk"
},
"v7": {
"author": "PSYK",
"description": "A1 Distane ,A2 Isolate ,B1 Rdmn ,B2 Main",
"genre": "Techno",
"imgSrc": "https://i.discogs.com/z8ORhybojMioq2zuApKcQw64BOj1NZYy5BRp61o3HxE/rs:fit/g:sm/q:40/h:300/w:300/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTM4NjIx/MjItMTM2MDUwNjM5/MC02MjIzLmpwZWc.jpeg",
"name": "Distane E.P.",
"price": "15",
"youtubeLink": "https://youtu.be/2qDCoLvBaVo"
},
"v8": {
"author": "Sterac Electronics ",
"description": "A Keep On Running ,B1 Destination Reached ,B2 Next Destination (Dub)",
"genre": "Techno",
"imgSrc": "https://i.discogs.com/VQ0Q_PEJLllfK5tga85qnHeCx7KyqOOdcqIvstt6_ss/rs:fit/g:sm/q:90/h:600/w:600/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTIxNjE4/OC0xMjAwMzIwMjE4/LmpwZWc.jpeg",
"name": "Keep On Running",
"price": "42",
"youtubeLink": "https://youtu.be/7RHqlCwz2jU"
}
}
WishList table:
"WishList": {
"-N5nJXczFMxIzVdOUtMc": {
"author": "Pink Floyd",
"imgSrc": "https://i.discogs.com/L_VyYyJq5qz9dKeMRuRSGg3ftbl-sadWu4oaJotdn-M/rs:fit/g:sm/q:90/h:600/w:588/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTIwNDE2/MTgtMTM5MDY3OTAy/NS0yMzcyLmpwZWc.jpeg",
"name": "The Wall",
"price": "20$",
"userId": "Qi8HU8YFMLhKhvoiHLkR6ooqnOp2",
"vinylId": "v1"
},
"-N5p9QJucK2kGs0EMhBO": {
"author": "Pink Floyd",
"imgSrc": "https://i.discogs.com/L_VyYyJq5qz9dKeMRuRSGg3ftbl-sadWu4oaJotdn-M/rs:fit/g:sm/q:90/h:600/w:588/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTIwNDE2/MTgtMTM5MDY3OTAy/NS0yMzcyLmpwZWc.jpeg",
"name": "The Wall",
"price": "20$",
"userId": "rTEp7K1cE8W4pZF9diB09ZxWfC72",
"vinylId": "v1"
}
},
Rating table:
"RatingUsersVinyls": {
"-N5fUpaXS_kKk_AtIPs1": {
"rating": "4",
"userId": "DiL1JNTc4RO7Eyr2tczv84Q3FII3",
"vinylId": "v1"
}
},

Related

Office 365 API - Get meeting room location and capacity

I'm doing an integration of mobile app with the Office 365 Calendar. I want to show room capacity and location on the screen. I trying to find an API to get meeting room info (this info is available on website when selecting room as user).
I tried both Outlook REST API (version 2.0) and Microsoft Graph but found nothing in the docs on how to get such info.
Where I can find such API if it exists?
I know this is an old question but you can do it using the List Places API in Graph API: https://learn.microsoft.com/en-us/graph/api/place-list?view=graph-rest-1.0&tabs=http
GET https://graph.microsoft.com/v1.0/places/microsoft.graph.room
RESPONSE:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#places/microsoft.graph.room",
"value": [
{
"id": "3162F1E1-C4C0-604B-51D8-91DA78989EB1",
"emailAddress": "cf100#contoso.com",
"displayName": "Conf Room 100",
"address": {
"street": "4567 Main Street",
"city": "Buffalo",
"state": "NY",
"postalCode": "98052",
"countryOrRegion": "USA"
},
"geoCoordinates": {
"latitude": 47.640568390488626,
"longitude": -122.1293731033803
},
"phone": "000-000-0000",
"nickname": "Conf Room",
"label": "100",
"capacity": 50,
"building": "1",
"floorNumber": 1,
"isManaged": true,
"isWheelChairAccessible": false,
"bookingType": "standard",
"tags": [
"bean bags"
],
"audioDeviceName": null,
"videoDeviceName": null,
"displayDevice": "surface hub"
},
{
"id": "3162F1E1-C4C0-604B-51D8-91DA78970B97",
"emailAddress": "cf200#contoso.com",
"displayName": "Conf Room 200",
"address": {
"street": "4567 Main Street",
"city": "Buffalo",
"state": "NY",
"postalCode": "98052",
"countryOrRegion": "USA"
},
"geoCoordinates": {
"latitude": 47.640568390488625,
"longitude": -122.1293731033802
},
"phone": "000-000-0000",
"nickname": "Conf Room",
"label": "200",
"capacity": 40,
"building": "2",
"floorNumber": 2,
"isManaged": true,
"isWheelChairAccessible": false,
"bookingType": "standard",
"tags": [
"benches",
"nice view"
],
"audioDeviceName": null,
"videoDeviceName": null,
"displayDevice": "surface hub"
}
]
}

Timezones in Google Mail Markup

We recently implemented the Rental car Mail Markup. For this we implemented the pickup and dropoff time as ISO dates as shown in the documentation. Nevertheless it appeared to us that the timezones of our dates has been ignored and thus we removed the timezone and add the date in local time of the pickup destination. Now we still get reports that in some occasions our date is interpreted as being UTC+0 and then displayed with a wrong time. What is the right way to put in the date so that it will be correctly displayed in google mail?
Thanks in advance
Our Mail includes this snippet
{
"#context": "http://schema.org",
"#type": "RentalCarReservation",
"reservationNumber": "K0523X3368",
"reservationStatus": "http://schema.org/Pending",
"url": "...",
"underName": {
"#type": "Person",
"name": "....",
"email": "..."
},
"programMembership": {
"#type": "ProgramMembership",
"memberNumber": ...,
"program": "..."
},
"bookingAgent": {
"#type": "Organization",
"name": "...",
"url": "..."
},
"reservationFor": {
"#type": "RentalCar",
"name": "FIAT PANDA",
"model": "MBMR",
"brand": {
"#type": "Brand",
"name": "FIAT PANDA"
},
"description": "FIAT PANDA",
"rentalCompany": {
"#type": "Organization",
"name": "Hiper Rentacar"
}
},
"pickupLocation": {
"#type": "Place",
"name": "Palma de Mallorca Airport",
"address": {
"#type": "PostalAddress",
"streetAddress": "Palma de Mallorca Airport",
"addressLocality": "Palma",
"postalCode": "07611",
"addressRegion": "ES",
"addressCountry": "ES"
}
},
"pickupTime": "2019-02-13T14:00:00.000+00:00",
"dropoffLocation": {
"#type": "Place",
"name": "Palma de Mallorca Airport",
"address": {
"#type": "PostalAddress",
"streetAddress": "Palma de Mallorca Airport",
"addressLocality": "Palma",
"postalCode": "07611",
"addressRegion": "ES",
"addressCountry": "ES"
}
},
"dropoffTime": "2019-02-14T08:00:00.000+00:00",
"cancelReservationUrl": "...",
"modifyReservationUrl": "...",
"potentialAction": [
{
"#type": "EditAction",
"target": "..."
}
],
"price": 16.91,
"priceCurrency": "EUR",
"modifiedTime": "2018-05-23T09:20:32.861Z"
}
the resulting card looks like that
mail card
All dates are shown in UTC although my machine is currently located in Germany and the rentlocation is in Spain (both CEST)

rxkotlin groupby is not working

could you please help me to group by the following json and return a hashMap in kotlin based on date with RxKotlin? is so easy with just kotlin but really stuck for Rxkotlin. thanks
val groupedTransactions = accountTransactions.transactions
?.groupBy { it.effectiveDate }
"transactions": [{
"id": "44e5b2bc484331ea24afd85ecfb212c8",
"effectiveDate": "20/07/2017",
"description": "Kaching TFR from JOHN CITIZEN<br/>xmas donation",
"amount": 12.00
}, {
"id": "1506aeeb8c3a699b1e3c87db03156428",
"effectiveDate": "20/07/2017",
"description": "Wdl ATM CBA ATM CIRCULAR QUAY STATION NSW 221092 AUS",
"amount": -200.00,
"atmId": "129382"
}, {
"id": "9a899bfd978511e9605774e1d5222b67",
"description": "Savings",
"effectiveDate": "19/07/2017",
"amount": 10.00
}, {
"id": "1a6c48627cecaa2388b702fa33d751ff",
"description": "PTAG COCA COLA AMATI",
"effectiveDate": "12/07/2017",
"amount": -2.20
}, {
"id": "7ecc19e1a0be36ba2c6f05d06b5d3058",
"description": "Wdl ATM CBA ATM TOWN HALL SQUARE NSW 253432 AUS",
"effectiveDate": "04/07/2017",
"amount": -50.00,
"atmId": "137483"
}, {
"id": "b71bf065b640217dad602f86ac047722",
"description": "BPAY - Telstra mobile",
"effectiveDate": "04/07/2017",
"amount": -49.00
},{
"id": "ef087651eb482bae4624478696f4ad4f",
"description": "Transfer from REBECCA SHAW<br/>Lorem ipsum",
"effectiveDate": "03/07/2017",
"amount": 150.00
}, {
"id": "8cd283d8b7bacc277f2bae5e26ce6d1e",
"description": "Savings",
"effectiveDate": "01/07/2017",
"amount": 200.00
}, {
"id": "04117d2d74f5331f3ee4955da27cca7a",
"effectiveDate": "28/06/2017",
"description": "Transfer - Saturday drinks",
"amount": -100.00
}, {
"id": "821ae63dbe0c573eff8b69d451fb21bc",
"effectiveDate": "21/06/2017",
"description": "Wdl ATM CBA ATM CIRCULAR QUAY STATION NSW 221092 AUS",
"amount": -200.00,
"atmId": "129382"
}]
this looks lik the rxkotlin issue. I've done it through coroutine kotlin like:
doAsync { val groupedTransactions = accountTransactions.transactions ?.groupBy { it.effectiveDate } ....

How to create customer & items in quickbook through api in rails?

I want to create invoice in my Quickbooks account through API from my rails application, but it requires to add customer and item before creating invoice. But I can't get the idea how to add customer and items through API. Can you suggest me???
Thanks.
Start here:
https://developer.intuit.com/
Follow the docs (https://developer.intuit.com/docs/0100_accounting) and implement OAuth to connect to QuickBooks Online.
Create customers by HTTP POSTing a JSON request to QuickBooks Online:
https://developer.intuit.com/docs/api/accounting/Customer
The JSON request will look something like this:
{
"BillAddr": {
"Line1": "123 Main Street",
"City": "Mountain View",
"Country": "USA",
"CountrySubDivisionCode": "CA",
"PostalCode": "94042"
},
"Notes": "Here are other details.",
"Title": "Mr",
"GivenName": "James",
"MiddleName": "B",
"FamilyName": "King",
"Suffix": "Jr",
"FullyQualifiedName": "King Groceries",
"CompanyName": "King Groceries",
"DisplayName": "King's Groceries",
"PrimaryPhone": {
"FreeFormNumber": "(555) 555-5555"
},
"PrimaryEmailAddr": {
"Address": "jdrew#myemail.com"
}
}
You'll get back something like this:
{
"Customer": {
"Taxable": true,
"BillAddr": {
"Id": "112",
"Line1": "123 Main Street",
"City": "Mountain View",
"Country": "USA",
"CountrySubDivisionCode": "CA",
"PostalCode": "94042"
},
"Notes": "Here are other details.",
"Job": false,
"BillWithParent": false,
"Balance": 0,
"BalanceWithJobs": 0,
"CurrencyRef": {
"value": "USD",
"name": "United States Dollar"
},
"PreferredDeliveryMethod": "Print",
"domain": "QBO",
"sparse": false,
"Id": "67",
"SyncToken": "0",
"MetaData": {
"CreateTime": "2015-07-23T10:58:12-07:00",
"LastUpdatedTime": "2015-07-23T10:58:12-07:00"
},
"Title": "Mr",
"GivenName": "James",
"MiddleName": "B",
"FamilyName": "King",
"Suffix": "Jr",
"FullyQualifiedName": "King's Groceries",
"CompanyName": "King Groceries",
"DisplayName": "King's Groceries",
"PrintOnCheckName": "King Groceries",
"Active": true,
"PrimaryPhone": {
"FreeFormNumber": "(555) 555-5555"
},
"PrimaryEmailAddr": {
"Address": "jdrew#myemail.com"
},
"DefaultTaxCodeRef": {
"value": "2"
}
},
"time": "2015-07-23T10:58:12.099-07:00"
}
Make sure you save that Id attribute, you'll need that later.
The process for creating Items is similar. Docs:
https://developer.intuit.com/docs/api/accounting/Item
Everything is just standard OAuth requests. Go grab an OAuth library for Rails and you should be all set.

What exactly is working for the EventReservation type

I created a quite complex schema of the EventRegistration type.
It contained two tickets, had images, contact details, etc.
But all I could get once was a Now card that only contained the title of the event, the date, the location and a action button to open the mail.
I'm wondering, if all the additional data has some error or if this is currently all that is supported. I would have loved to see Logos, contact details, a cancellation link and of course the ticket itself (=QR-Code + download link). This would have been such a nice alternative to Apple's Passbook.
What are the plans for this feature? Is this still going to be developed, is there perhaps already a rough roadmap on when to expect this?
Additionally what I was wondering about is, that the "Email Markup Tester" was complaining that the ticketToken property would be invalid for that type, even though the documentation clearly states that it is part of the EventReservation type.
FYI, here is the anonymized schema I used:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "EventReservation",
"reservationNumber": "TFXLLUS00008",
"reservationStatus": "http://schema.org/Confirmed",
"underName": {
"#type": "Person",
"name": "Name 1",
"email": "...#gmail.com"
},
"bookingAgent": {
"#type": "Organization",
"name": "My company",
"description": "My company - online ticketing",
"image": "http://www.MyCompany.com/link/to/logo_1500x1500px.jpg",
"url": "http://www.MyCompany.com",
"url/googlePlus": "https://plus.google.com/+MyCompany/",
"ContactPoint": {
"#type": "ContactPoint",
"email": "support#MyCompany.com",
"telephone": "123456789"
}
},
"reservationFor": {
"#type": "Event",
"name": "Test-Event",
"startDate": "2014-04-26T20:00:00+00:00",
"endDate": "2014-04-30T18:00:00+00:00",
"description": "This is a test event for demo purposes.",
"image": "http://www.MyCompany.com/link/to/event/logo.png",
"url": "http://www.MyCompany.com/link/to/event.html",
"location": {
"#type": "Place",
"name": "Congress hall",
"address": {
"#type": "PostalAddress",
"streetAddress": "Street. 1",
"addressLocality": "City",
"addressRegion": "",
"postalCode": "12345",
"addressCountry": "DE"
}
}
},
"ticketToken": "qrCode:4641484423168988",
"ticketNumber": "1690-8587-4723",
"numSeats": "1",
"ticketDownloadUrl": "https://www.MyCompany.com/linkToTicket.pdf",
"ticketPrintUrl": "https://www.MyCompany.com/linkToTicket.pdf",
"price": "100",
"priceCurrency": "EUR",
"bookingTime": "2014-04-26T13:57:50+00:00",
"modifiedTime": "2014-04-26T13:57:50+00:00"
},
{
"#context": "http://schema.org",
"#type": "EventReservation",
"reservationNumber": "TFXLLUS00008",
"reservationStatus": "http://schema.org/Confirmed",
"underName": {
"#type": "Person",
"name": "Name 2",
"email": "...#gmail.com"
},
"bookingAgent": {
"#type": "Organization",
"name": "My company",
"description": "My company - online ticketing",
"image": "http://www.MyCompany.com/link/to/logo_1500x1500px.jpg",
"url": "http://www.MyCompany.com",
"url/googlePlus": "https://plus.google.com/+MyCompany/",
"ContactPoint": {
"#type": "ContactPoint",
"email": "support#MyCompany.com",
"telephone": "123456789"
}
},
"reservationFor": {
"#type": "Event",
"name": "Test-Event",
"startDate": "2014-04-26T20:00:00+00:00",
"endDate": "2014-04-30T18:00:00+00:00",
"description": "This is a test event for demo purposes.",
"image": "http://www.MyCompany.com/link/to/event/logo.png",
"url": "http://www.MyCompany.com/link/to/event.html",
"location": {
"#type": "Place",
"name": "Congress hall",
"address": {
"#type": "PostalAddress",
"streetAddress": "Street. 1",
"addressLocality": "City",
"addressRegion": "",
"postalCode": "12345",
"addressCountry": "DE"
}
}
},
"ticketToken": "qrCode:4020229019819219",
"ticketNumber": "5218-3082-0382",
"numSeats": "1",
"ticketDownloadUrl": "https://www.MyCompany.com/linkToTicket.pdf",
"ticketPrintUrl": "https://www.MyCompany.com/linkToTicket.pdf",
"price": "100",
"priceCurrency": "EUR",
"bookingTime": "2014-04-26T13:57:50+00:00",
"modifiedTime": "2014-04-26T13:57:50+00:00"
}
</script>

Resources