oncall | calendar tool designed for scheduling and managing on-call | Calendar library
kandi X-RAY | oncall Summary
kandi X-RAY | oncall Summary
Oncall
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Handle POST request
- Get schedules
- Check to see if the user has a team member
- Determine if someone has a hero
- Create an audit record
- Synchronize users
- Fetch LDAP credentials
- Removes inactive users from the database
- Get a dictionary of users defined in config file
- Handles GET requests
- Handle GET request
- Get all schedules
- Update an event
- Delete roster
- Generate a reminder
- Authenticate using ldap
- Load Slack users from Slack
- Populate event table
- Schedule events in the database
- Send a message
- Wait until MySQL is up
- Start send task
- Decorator to require a user to be logged in
- Setup logging
- Create a section tree
- Populate team_dict
- Get WSGI application
oncall Key Features
oncall Examples and Code Snippets
Community Discussions
Trending Discussions on oncall
QUESTION
I would like to connect to my Atlas cluster only once per instance running Cloud Functions.
Here is my code for an instance :
...ANSWER
Answered 2022-Mar-25 at 16:08You can store your database client as a global variable. From the documentation,
Cloud Functions often recycles the execution environment of a previous invocation. If you declare a variable in global scope, its value can be reused in subsequent invocations without having to be recomputed.
Try refactoring the code as shown below:
QUESTION
I'm trying to save user data when the JavaScript event "beforeunload" is triggered. I call a server-side function (firebase cloud functions) that simply gets an object from the user and updates a document. The function does trigger, but from the firebase console I can see it finished with code 204. Here is my client code
...ANSWER
Answered 2022-Mar-16 at 21:43This will not be possible.
Browsers severely limit what you're allowed to do in a beforeunload
event, because it's so prone to abuse. Asynchronous events are not allowed (because they could force the window to stay open for an arbitrary amount of time after the user wants to close it.)
As far as I know, the only reliable usage of onbeforeunload
is to display a prompt allowing the user to change their mind; some browsers will let you customize the text that appears (by returning a string from the beforeunload
handler), some browsers will always show default text:
QUESTION
I am working to remedy some security vulnerabilities from a penetration test. The vulnerability in question is a "Web Server Vulnerable to HTTP Host Header Attack" with a recommendation of "...the Host request header is user specified and shouldn't be trusted. Ensure that strict white listing is used to validate the Host header."
I am currently using React.js as my frontend frame work and Firebase for Functions (Node.js), Hosting, Authentication, Storage and Analytics. I am not understanding from my general internet search where or even what I should be changing to remedy this vulnerability? I am gathering that I may be using code in my server calls that is using the raw "HOST" variable, but I don't see anywhere in my code this is accessed explicitly. I do have an functions.https.onCall()
function, which is maybe using the HOST internally. Obviously have many onCreate()
, onUpdate()
, etc calls. Maybe it is another function or library I am using behind the scenes?
What is the solution to prevent host header attacks on Firebase?
Firebase Functions package.json:
...ANSWER
Answered 2022-Mar-15 at 02:37If you are using Firebase Hosting, the report it likely referring to the fact that the Host
header is used to route requests to the appropriate site. This is working as intended -- since Firebase Hosting is a multi-tenant service, the Host
header provides necessary information to disambiguate between sites.
No action should be necessary on your part - Firebase already carefully validates the header against known sites.
QUESTION
exports.createUser = functions.https.onCall(async (data, _context) => {
const email = data.email;
const password = data.password;
try {
// First, create the user account.
const userRecord = await admin.auth().createUser({
email: email,
password: password,
});
// User successfully created, now update the database.
const userId = userRecord.uid;
const db = admin.firestore();
const batch = db.batch();
batch.create(
db.collection("userAccounts").doc(userId), {created: admin.firestore.FieldValue.serverTimestamp()},
);
await batch.commit();
// Database successfully updated, now return the newly-created userId.
return Promise.resolve(userId);
} catch (error) {
if (userId) {
// There was an error updating the database. However, a user was created
// beforehand. Therefore, delete the user before terminating the
// function.
admin.auth().deleteUser(userId); // <-- this throws
throw new functions.https.HttpsError("unknown", "Database error", error);
}
throw new functions.https.HttpsError("unknown", "Authentication error", error);
}
});
...ANSWER
Answered 2022-Mar-11 at 20:00It will not create an infinite loop, but the error won't be caught either - which should be avoided. You'll need to tack on another .catch
, because you also want to throw a different error afterwards.
QUESTION
Such as described here, I'm using local emulator (on-line) to make tests im my cloud functions.
Index.js:
...ANSWER
Answered 2022-Mar-03 at 18:03Something very important to point out is that you are currently trying to use a Firebase callable function, as shown by the function heading functions.https.onCall(() => {});
. Since you want to work with requests and response codes, the correct type of function to use is an HTTP function. You would only need to change the heading in your index.js
:
QUESTION
Below is my firebase function:
...ANSWER
Answered 2022-Mar-02 at 16:47You don't have to pass user's UID in callable cloud function. The user must be logged in with Firebase authentication and Firebase SDKs will take care of the rest.
Can you try logging current user in deleteAccount
function before calling cloud function just to ensure user is logged in? Also context.auth.uid
is UID of user that is calling the function. If you want to access the userId that you are passing in the function, refactor the code as shown below.
The deleteUser()
function would take only 1 parameter that's the data you want to pass in Cloud functions.
QUESTION
we currently facing the problem in our flutter app, that httpsCallable functions which are defined with a region, in our case "europe-west1", is throwing an exception:
...ANSWER
Answered 2022-Feb-08 at 17:03After some testing and the comment from Peter Koltai, the solution is defining the region in both, flutter and cloud functions:
flutter:
QUESTION
I am trying to add Custom roles to my user in my Flutter app. I saw some tutorials which uses Cloud functions to assign roles to user using Node js language(not dart) script because one should not assign customRoles from the frontEnd side of app.
...ANSWER
Answered 2022-Jan-21 at 19:05The ability to set custom claims for a user is only available in our SDKs for trusted environments, such as the Admin SDK for Node.js that used in the code in your question.
This functionality is not available in the client-side SDK by design, as it'd be a huge security risk to allow this. While you may think this is acceptable, the client-side SDKs will not help you going down this path.
The only way to do this from a Flutter app, is to create a Cloud Function like the one you have, and call that from your Flutter code. This also then gives you a chance to secure the operation in Cloud Functions by checking if the user is authorized to add the claim to their account.
QUESTION
I'm using Firebase as backend to my iOS app and can't figure out how to construct a batch write through their Cloud Functions.
I have two collections in my Firestore, drinks and customers. Each new drink and each new customer is assigned a userId
property that corresponds to the uid of the currently logged in user. This userId
is used with a query to the Firestore to fetch only the drinks and customers connected to the logged in user, like so: Firestore.firestore().collection("customers").whereField("userId", isEqualTo: Auth.auth().currentUser.uid)
Users are able to log in anonymously and also subscribe while anonymous. The problem is if they log out there's no way to log back in to the same anonymous uid. The uid is also stored as an appUserID
with the RevenueCat SDK so I can still access it, but since I can't log the user back in to their anonymous account using the uid the only way to help a user access their data in case of a restoring of purchases is to update the userId
field of their data from the old uid to the new uid. This is where the need for a batch write comes in.
I'm relatively new to programming in general but I'm super fresh when it comes to Cloud Functions, JavaScript and Node.js. I dove around the web though and thought I found a solution where I make a callable Cloud Function and send both old and new userID with the data object, query the collections for documents with the old userID and update their userId
fields to the new. Unfortunately it's not working and I can't figure out why.
Here's what my code looks like:
...ANSWER
Answered 2022-Jan-17 at 21:11As you already guessed, the call customerQuery.get()
returns a promise.
In order to understand what you need, you should first get familiar with the concept of promises here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
For your use case, you will probably end up with either using the then
callback:
QUESTION
I am trying to understand how we can securely call a firebase callable function from firebase https function, Here auth is required so that callable function is not public, it should be accessible only by that https function.
Note: I am new to gcloud and firebase :(
Https Function:
...ANSWER
Answered 2021-Dec-27 at 14:59I would say this isn't possible because, as you mentioned, the auth checks cannot be done without the browser, also the httpsCallable
interface does not allow the context to be forced by passing as a parameter.
I would say that the best option would be to convert your Callable Function into an Http Function where you can implement your own authentication checks, this documentation may be useful for that.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install oncall
You can use oncall like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page