Is it possible to disable writes, updates and deletes from web admin console? - google-cloud-firestore

Is it possible to disable writes, updates and deletes from web admin console? ( Allowed Read Only )
I want write, update or delete from client side only ( Using Code Only )

Is it possible to disable writes, updates and deletes from web admin
console?
With "web admin console" I guess you are speaking about the Firebase console.
If you want to assign to a user a read-only permission, in such a way he/she can only view (but not modify) existing data, you can assign the Viewer role to this user. See the doc.

Related

How to send Session ID parameter out FROM Moodle?

I need to send user-specific values to an external system from Moodle. How can I force Moodle to send the session ID (or user ID, activity ID, etc.) to this third-party system? All of the articles out there seem to be written for calling into Moodle but this is not what I need to do.
Important:
I cannot alter the Moodle installation. The solution must only involve editing content. This means I cannot author a new plugin or alter any of the Moodle source code.
Edit:
I do have direct access to the Moodle database from a separate external API. The goal was to use this connection to validate the incoming parameters. However, I still need to be able to construct a parameterized URL to call out the external app. That app would then be able to validate the supplied values against the database. If the session ID is not available then I would need the values regarding the page, user, module, etc. to be sent via the parameterized URL.
For the session id do you mean the current user session? There is a session key stored in $_SESSION['USER']->sesskey but its not really useful data. It expires when a user logs out.
$_SESSION is server side, so you would need to use PHP code which isn't allowed in content for security reasons.
Have you got access to the database? You could pull user id and activity id from there. Otherwise you will need to use an API or a plugin.
EDIT: There is a URL activity that you could use to send data externally. But that would require the user to click the link.
Data includes user and course ids.
https://docs.moodle.org/311/en/URL_resource_settings
I can't think of any solution to send data externally without writing some PHP code or adding a plugin.
You can add javascript to every page via Site administration > Appearance > Additional HTML but the session variables aren't available without PHP.
https://docs.moodle.org/311/en/Header_and_footer

Connecting to MongoDB to be used in UIPath

I am trying to connect to MongoDB so I can use it in UIPath but there are no APIs available other than DB administrative APIs. I want to manipulate the actual data in the data table. How can I do this, other than creating a robot that manipulates the table directly.
If you are using MongoDB Atlas, which is Cloud based, does not have ANY CRUD APIs. In MongoDB Server side, the CRUD APIs are deprecated so for sure they will not have it in the cloud version.
Unfortunately, you will need to go through a third party to connect to MongoDB. Luckily there are a few out there. The one I like to use is PrestoAPI.
Got to the PrestoAPI Website: https://prestoapi.com/
Click on get started for free
Fill out the user data, select if this is for personal or business and then select Free
There will be a confirmation email sent
Confirm your email, (you may have to resend the confirmation link) and then sign in
Once you log in, you will see this:
Click on Connect to A Database
Click again to get this pop up
All information needed is in the connection string we got from MongoDB
Driver is MongoDB
We will use the database Sample_airbnb from the database sample
Click on test
Once it says connection successful, we can move on
FYI, sometimes PrestoAPI will drop the “+srv” from the beginning of the connection string. Ensure that this part is correct or recopy again from MongoDB
You will get this result
Go back to the dashboard and click on Create a project
You should see the AirBNB name
Click on Submit
Next, select “Create your first endpoint”
It will give you a list to go through. Ensure you pick the name of the Endpoint (you only get 10 of them)
Select the database, the component (Table) and the table you want to read
For now, everything else can stay as default but you can always go back and tweak them
Once complete, click Submit. You now have a list of usable CRUD APIs for your MongoDB Atlas
You can now use these end points and call them in Node.js, UIPath or wherever a regular REST API can be called
You can use Invoke code activity. Here is the detailed step-by-step answer

Github Enterprise activate dormant users

I am using Github Enterprise v2.13.5 and want to activate dormant users. Currently Github automatically activates the dormant user when they log back in. But I need to explicitly activate all dormant users
The /users API does not tell us whether a User is dormant or not. There are some manual workarounds for at least identifying the inactive users , but most that I found are not feasible in practice.
If you do not need any information on which user was dormant, you could write a little script that automatically creates impersonation tokens for each user and (in their name) do one arbitrary action on Github:
With your account, create a project [yourname]/un-dormant-project
For each known user (get via /users API):
a. Create an impersonation token
b. In the name of the user, perform an arbitrary action on [yourname]/un-dormant-project
c. Delete impersonation token
I assume that you must not delete the project you created because otherwise the users will become dormant again very quickly.
Disclaimer: I did not try this approach out.

Issues SQL connection with a specific account

I'm having an issue with the CloudSQL connection on a specific account.
If I use account A to preview the project it works fine, yet account B with the exact same cloudSQL credentials is unable to preview, account B is the owner of the project.
They both have the same IAM roles in the cloudSQL project and both accounts were able to preview last week.
I've tried deleting cache, navigation files and another browser using account B.
Any ideas?
I'm going to add a new answer to resolve this because I think it's worthwhile to keep the previous answer and discussion intact. The issue here was that the accounts which did not work have the "Viewer" role in the IAM & Admin section of the Google Cloud SQL project. The Viewer role gives (among other permissions) read access to Cloud SQL, but not write access.
The best role to use if restricted access is required, but they need full access to read/write SQL, is the Google Cloud SQL Client role. See https://cloud.google.com/sql/docs/mysql/project-access-control for more information on roles and what access they give.
Thanks for Juan for help tracking all this down.
Edit: It's also worth mentioning that the reason this works in the Editor, but not in Preview/Deployments is the editor is explicitly whitelisted for access (as one of the steps we ask you to do in the documentation), so it doesn't use role permissions for a particular account, while access through your deployments is not explicitly whitelisted in this way, so role permissions are enforced.
Do the following, in Incognito windows in Chrome (to make sure you're using the correct account):
1) Log into the account it is not working with.
2) In the Google Cloud SQL tab, press Update, and enter new credentials, wait for it to finish, and then try to preview.
3) Assuming this does not work, now close your incognito window and log into the account it is working with.
4) Repeat step #2 (entering new the same credentials).
If you cannot access it after step #2, but you can access on step #4, and if both users can modify the SQL model from App Maker, then there is a probably strange bug we (the App Maker team) needs to look into.

Mongodb - how to add database user through spring application

I want to implement database authentication in mongodb.
In order to do that, I found out that I need to first create an admin user and then create separate users for each of my database through mongodb client shell (manually or using a javascript file).
I was wondering if it is possible to add user to the individual databases from the spring application itself but did not get any useful pointers to do this. Is it that this approach is wrong because if this possible the application will always be able to access the database because it itself is creating the user, but external access will still be blocked.
Please let me know how this can be achieved or if it is an incorrect approach.
After you add a normal user via the MongoShell, you can then connect via your application and create either normal users, or read only users.
Note that a normal user can also add users, so the users your application adds may need to be down as read only users depending on your use case and needs.
In the MongoShell, adding a read only user can be done via
use myAppDB
db.addUser("JohnSmith", "CheddarCheese", true)