Commit Graph

725 Commits

Author SHA1 Message Date
Shrikant Sharat Kandula
921c827817
Add isFromInvite field to create_USER event (#1223) 2020-10-15 17:42:37 +05:30
Prashant Chaubey
05380a9c43
Added email verification while creating user and sending email (#1208) 2020-10-15 12:19:20 +05:30
Prashant Chaubey
8d2701ed75
Made getAll operation of PageController unsupported (#1176) 2020-10-15 11:24:09 +05:30
Prashant Chaubey
67ef538409
Returning validation failures while creating organization (#1084)
* Returning validation failures while creating organization

* Added unit tests

* Changing the name of test security config

Co-authored-by: nitesh261193 <nitesh261193@gmail.com>
2020-10-15 09:07:57 +05:30
Shinn Lok
e85d5ed420
TTL must be set on date field (#1128)
The PasswordResetToken collection now expires the password reset request in 48 hours.
2020-10-15 09:01:30 +05:30
Shrikant Sharat Kandula
ff860e402c
Add logging to segment SDK (#1188) 2020-10-15 00:05:09 +05:30
Shrikant Sharat Kandula
8af1852b6a
Refactor tasks on first-login (#1190)
* Primarily doing example app cloning and analytics in parallel.

* Only create a examples organization, if not already done
2020-10-15 00:02:57 +05:30
Shrikant Sharat Kandula
02dc63840a
Don't send full object to analytics (#1186) 2020-10-14 14:56:09 +05:30
Shrikant Sharat Kandula
164824ca85
Add first_login event for analytics (#1184) 2020-10-14 12:40:47 +05:30
Prashant Chaubey
8a892b6e15
Removed invitation token from the invite email (#1180) 2020-10-14 10:30:19 +05:30
Trisha Anand
421b624cc4
Only mark applications as example applications if the application id exists in the template configuration. (#1093) 2020-10-09 15:21:28 +05:30
Shrikant Sharat Kandula
d872b3631b
Use username instead of object_id in analytics (#1082) 2020-10-09 12:47:27 +05:30
Trisha Anand
ffb1142b20
Adding a new email template for sending an email when an appsmith use… (#1077)
* Adding a new email template for sending an email when an appsmith user's role in an organization changes.

* Minor changes in text.
2020-10-08 14:48:41 +05:30
Shrikant Sharat Kandula
feda7ce022
Use email as id for users and fix signup events not being reported (#1067) 2020-10-07 21:06:58 +05:30
Shrikant Sharat Kandula
c77fcfa9ee
Send separate user create event for new users (#1066) 2020-10-07 18:28:17 +05:30
Shrikant Sharat Kandula
c4332b9a1c
Add source to user sign up event (#1065) 2020-10-07 18:07:30 +05:30
Prashant Chaubey
50072ff179
Fixed the ipify URL in PingScheduledTask (#1013) 2020-10-06 06:54:27 +05:30
Petro Popelyshko
e57615e3eb
Fix(backend): Wrong error message while resetting the password fixed, changed from id to email (#911)
Fixes #637
2020-10-05 09:49:05 +05:30
Dmitriy Danilov
4a26aee19f
Fix(sign-up): change in sign up error message (#908) 2020-10-05 09:42:39 +05:30
Shrikant Sharat Kandula
577e9a7017
Refactor ignoreCache parameter to use Boolean type (#681) 2020-09-23 11:01:58 +05:30
Shrikant Sharat Kandula
19bd7d272a
Use a unique instance ID for pinging home (#566)
* Use a unique instance ID for pinging home

* Fix event name
2020-09-18 06:38:53 +05:30
Arpit Mohan
e688f62378
Removing cacheResponse from the JSON response for actions (#564)
This is because this `cacheResponse` field is only used for auto-complete on the UI. The user can still run the action manually and get the auto-complete to work. The downside to sending the `cacheResponse` field in the JSON response is that for large responses, the client times out as our response times increase to 20 secs. Hence removing this for now.

In future, we'll extract the JSON schema structure from the response body and send that to the client for populating auto-complete.
2020-09-17 18:51:26 +05:30
Shrikant Sharat Kandula
65c247a10c
Add a scheduled task to ping home (#560)
* Add a scheduled task to ping home

* Removed commented logging code

* Add docstrings to ping scheduled task

* Move IP address API URI to a constant
2020-09-17 17:54:48 +05:30
Shrikant Sharat Kandula
75ba90928e
Add datasource structure caching and MySQL structure support (#553)
* Implement caching for datasource structure

* Avoid using final fields so spring-data can load objects

* Use type variable for getStructure method

* Initial version with base structure for MySQL plugin

* Add tests for MySQL plugin structure

* Add sorting for keys in Postgres structure as well

* Show "primary key" instead of just "primary"

* Refactor to reduce inline magic strings
2020-09-17 13:59:46 +05:30
Nikhil Nandagopal
cac15f2cac
Update welcomeUserTemplate.html 2020-09-16 18:40:43 +05:30
Trisha Anand
423b7eb176
Added confirmBeforeExecute field in action view dto which is returned only during view mode. (#547)
* Added `confirmBeforeExecute` field in action view dto which is returned only during view mode.

* Added test for fetch actions in view mode.
2020-09-15 15:22:35 +05:30
Shrikant Sharat Kandula
6c7e45d010
Add a connection type variable for Plugin implementations (#531)
* Add a connection type variable for Plugin implementations

This type variable is intended to represent the type of the
connection object, if any, that the plugin will use. This will
help make the implementations more robust by leveraging Java's
type checking instead of rudimentary type casts over the
connection objects.

* Fix missing typevar usage
2020-09-14 20:36:47 +05:30
Shrikant Sharat Kandula
3f5930e52e
Add datasource structure support for DB plugins (#523)
* Base interface for getting datasource structure for databases

* Add keys and constraints to structure for Postgres datasources

* Use connection from datasource context for computing structure

* Refactor context retrying into a separate method

* Add base datastructures for templates in entity explorer

* Fix spring circular dependency

* Add test for postgres datasource structure

* Generate column names and sample values for INSERT query

* Add LIMIT clause to generated SELECT query

* Fix tests for generated SELECT query

* Minor refactoring
2020-09-14 18:59:11 +05:30
Trisha Anand
069dd53e32
Changing spelling of colour to match the front-end used spelling. (#532) 2020-09-11 12:31:07 +05:30
Nikhil Nandagopal
3b4db07697
Update welcomeUserTemplate.html 2020-09-10 16:20:00 +05:30
Nikhil Nandagopal
5fbe993541
Update welcomeUserTemplate.html 2020-09-10 16:01:35 +05:30
Nikhil Nandagopal
9063488acf
Update welcomeUserTemplate.html 2020-09-10 14:50:44 +05:30
Trisha Anand
9dcb7d5522
When on page load setting is changed, update layout must be called to update the onPageLoadActions field in the layout. (#467) 2020-09-10 14:30:30 +05:30
Shrikant Sharat Kandula
42545d1e88
Add migration to fix incorrect action IDs for onLoad (#519)
* Add migration to fix incorrect action IDs for onLoad

* Remove redundant comments

* Fix migration to work with published onLoad actions as well

* Only update the action ID when correcting onLoad action IDs

* Fix migration name for correcting action IDs

Co-authored-by: Trisha Anand <trisha@appsmith.com>

* Fix migration id for correcting action IDs

* Reformat code

Co-authored-by: Trisha Anand <trisha@appsmith.com>
2020-09-10 11:37:32 +05:30
Shrikant Sharat Kandula
f5f66229ec
Get list of application IDs to be cloned as examples from template config (#442)
* Get list of application IDs to be cloned as examples

* Fix tests so that apps to be cloned are explicit

* Add migration to set applicationIds for example cloning

* Fix example org cloning tests
2020-09-07 11:40:28 +05:30
Trisha Anand
a8a7955f41
Added new fields colour and icon in application required for homepage redesign project (#499) 2020-09-07 11:13:58 +05:30
Trisha Anand
437d04f045
Added a field to denote confirmBeforeExecute field whose functionality would be handled by the client. (#487) 2020-09-07 11:12:08 +05:30
Trisha Anand
3648a2b804
Returning an error in case the user tries to get all users. (#472) 2020-09-02 17:18:22 +05:30
Shrikant Sharat Kandula
54c75b26dd
Add a node.js script to dump examples organization (#448)
* Add a node.js script to dump examples organization

This dump file is used to setup initial examples organization
in a self-hosted setup.

* Remove unused variable

* Add npm run shortcut for dump script
2020-09-02 17:15:55 +05:30
Shrikant Sharat Kandula
91ad617904
Add validation for host values in DB datasources (#444)
* Add validation for host values in DB datasources

* Mild refactoring, for a dummy commit

* Add test for host name validation in datasources
2020-09-02 11:28:41 +05:30
Shrikant Sharat Kandula
223a735b87
Add API for uploading logo images for organizations (#376)
* Start with new controller for assets

* Progress on uploading logo image

* Saving and loading organization logo assets now works

* Remove existing logo asset before saving a new one

* Fix 500 when uploading logo for the first time

* Fix URL in response for uploading logo image

* Add test for uploading logo for ogranization

* Mild refactoring in tests
2020-09-02 11:28:15 +05:30
Trisha Anand
dfabda6009
GET API actions recognized as page load actions should also be update… (#450)
* GET API actions recognized as page load actions should also be updated as executeOnLoad actions.

* Update action during updateLayout only if executeOnLoad is not set or is false.
2020-08-27 20:05:07 +05:30
Trisha Anand
a806935f82
Use a new API to set (unset) execute on load for an action. (#443) (#446) 2020-08-27 16:22:50 +05:30
Shrikant Sharat Kandula
9534eeef0a
Add logs to alert when cloned action id is unavailable (#441) 2020-08-27 12:46:04 +05:30
Trisha Anand
11eac73013
Clone application within the same organization (#414)
* WIP : First draft of clone applications

* Cloning of application now works correctly.

* Fixed the failing test case for page cloning.

* Added test case to assert the clone of application successfully.

* Minor function renaming to avoid confusion.

* Minor code refactoring to remove duplicate code.
2020-08-25 14:08:52 +05:30
Trisha Anand
8c20aeb95b
Example app being cloned must be set to private instead of public because public permissions are not given during cloning. (#418) 2020-08-25 11:12:55 +05:30
Trisha Anand
c253b7430b
1. Fixed the bug where policies are being set to empty during organization update (#415)
1. Fixed the bug where policies are being set to empty during organization update.
2. Added email field in organization.

* Updated the test case for update organization to assert the organization policies being present post the update.
2020-08-25 08:13:37 +05:30
Trisha Anand
ce41fec346
Bug fix : Example applications should have make public permissions for the administrator. (#416) 2020-08-25 08:12:13 +05:30
Shrikant Sharat Kandula
ba72e21f7b
Add two more apps to examples org dump (#393)
* Add two more apps to examples org dump

* Fix undefined checks in example org dump
2020-08-21 19:53:16 +05:30
Shrikant Sharat Kandula
2a2dda0ab0
Fix race condition in setting default page in application (#394)
We are currently getting the *list* of all pages, updating the
`isDefault` fields inside, and then saving the whole *list* of
all pages. If a new page got added to that list in the DB during
this process, that page would be lost. This commit fixes this
problem.

This race condition was causing tests for cloning applications
to fail *sometimes*.
2020-08-21 16:31:40 +05:30
Shrikant Sharat Kandula
87f27c9182
Add two new/updated apps for self-hosted (#392)
* Add two new/updated apps for self-hosted

* Fix potential NPE when template org dump has API datasources
2020-08-21 14:37:35 +05:30
Shrikant Sharat Kandula
e97ceab412
Fix default page not being set for cloned applications (#383)
* Fix default page not being set for cloned applications

* Add test for setting default page in clone applications
2020-08-21 10:38:23 +05:30
Shrikant Sharat Kandula
27511c90d4
Users created won't have any orgs if a template is configured (#374) 2020-08-20 18:24:31 +05:30
Shrikant Sharat Kandula
3ae6c745b1
Initial implementation to import examples organization as a migration (#290) 2020-08-20 16:46:23 +05:30
Shrikant Sharat Kandula
bd670487a7
Redirect to forked application when signed up by clicking on Fork of a public example app (#335)
* Redirect to forked application works for direct login

Co-authored-by: Trisha Anand <trisha@appsmith.com>
2020-08-20 14:15:54 +05:30
Shrikant Sharat Kandula
f57e2a2fb8
Refactor: Remove unused type parameter in AnalyticsService (#340)
* Move repeated code for analytics into functions inside AnalyticsService

* Fix type parameters in BaseService & BaseController
2020-08-20 10:47:22 +05:30
Trisha Anand
efab105e19
Clone Page feature inside an application (#357)
* Working version of cloning page given page id. The clone is created inside the same application and is in unpublished state.

* Added a test case for Clone Page feature

* Incorporated review comments.
2020-08-19 15:20:00 +05:30
Trisha Anand
82018547f5
Added tests to test invite user permissions for administrators and developers and make public app permissions for only administrators. Also added test to ensure that roles for an organization are being returned depending on the current user's roles. (#326) 2020-08-18 10:53:46 +05:30
Trisha Anand
336514344b
If an invited user follows the path of reset password (instead of sign up), this should be allowed. (#328) 2020-08-17 14:57:41 +05:30
Shrikant Sharat Kandula
a79951bae9
Don't always automatically create a blank personal org (#306)
* Don't always automatically create a blank personal org

It will still be created, only if a example template organization
has not been configured in the system.

* Name examples organization same as personal organization

* Minor fixes in tests

* Remove unused userService in clone tests
2020-08-14 15:30:52 +05:30
Shrikant Sharat Kandula
50e8ee7255
Fix link in invite emails to point to signup page (#268)
* Fix link in invite emails to point to signup page

* Auto-fill email in signup page and remove CreatePassword component
2020-08-14 11:31:50 +05:30
Trisha Anand
52e7ed4f02
Bug Fix : When role changes from developer to admin, the user was not being given make application public permission for the application (#302)
* During add role to an organziation, the application was only inheriting from subset of the organization permissions. Generalized this code to ensure that this doesnt happen again in the future when more permissions are introduced. Refactored some code as well.
2020-08-13 18:53:00 +05:30
Arpit Mohan
10f462b229
Adding a test for the valid scenario when returning the plugin form details (#295)
We use @SpyBean annotation to partially mock the PluginService class.
2020-08-12 20:09:56 +05:30
Shrikant Sharat Kandula
368ed79f4b
Removed OPA config (#291)
* Removed OPA config along with the bundle and rules files
2020-08-12 16:52:42 +05:30
Shrikant Sharat Kandula
30c595678d
Set transient fields when loading application by id (#287) 2020-08-12 15:35:50 +05:30
Trisha Anand
c3c8e532c6
Updated the invite and make public app migration script more performant so that it takes lesser time on big db (#289)
* Updated the migration script to make more db queries instead of searching in the local app memory

* Permission correction.
2020-08-12 15:35:04 +05:30
Trisha Anand
7ee21456d5
Share Changes : Adding users to organization permission updates (#262)
* Introduced new permissions for making app public and inviting users.

* WIP : Returning a subset of roles depending on the current user's role

* Added code and tests for generating hierarchical children given a role name

* Get all invite roles now returns roles depending on the current users permissions (aka - admin can invite users for all roles, developers can invite users for roles develoeprs and below)

* When invite api is called, check if the user has correct permissions ( invite permission) and check if the role for which the users are bieng invited is allowed (aka the current user has the permission to invite for the said role)

* Introduced a new permission at application level which is inherited from manage:organizations. This new permission gives the administrator of the organization to make any application public .

* Incorporated review comments.

* Minor code changes.

* Added migration script to add the new policies introduced as part of this new share modal changes.

* Null pointer exception handled due to improper data in the database.

* Integration testing bug fixes.
2020-08-12 13:23:44 +05:30
Trisha Anand
a6496bd5af
Correcting the Docker image for Appsmith server for Github actions test (#260)
* Correcting the Docker image for Appsmith server for Github actions test

* Also fixing the bug where the datasource config is not returned properly for restapi-plugin

Co-authored-by: Arpit Mohan <arpit@appsmith.com>
2020-08-11 16:53:47 +05:30
Shrikant Sharat Kandula
115bff546c
Replace class-level generics with method-level in PolicyUtils (#257) 2020-08-11 14:07:52 +05:30
Shrikant Sharat Kandula
0c344115c3
Add transient field on applications to indicate whether it's an example application (#256)
* Add transient field on application to indicate whether it's an example

* Add test for marking of example applications

* Remove unused constant
2020-08-11 14:00:41 +05:30
Shrikant Sharat Kandula
dc10f09906
Fix organization cloning gets stale action IDs inside onLoad actions (#245)
* Fix organization cloning gets stale action ids for onload

* Fix test for onload action's organization after cloning
2020-08-11 13:58:50 +05:30
Trisha Anand
43d633f007
Setting role name while adding a user to an organizaiton. (#258) 2020-08-11 09:45:23 +05:30
Trisha Anand
d2442eb815
DO NOT MERGE: Bulk invite user to organization (#182)
* WIP: Not working bulk invite.

* WIP : Non compilable.

* Current test cases running.
TODO : Code Cleanup and write new test cases for bulk invite.

* Code cleanup

* Added a test case for bulk invite of users to an organization.

* Incorporated review comment.

* Merged the latest release and incorporated review comments.

* Corrected the error thrown when usernames is empty or null for invite user API.
2020-08-11 09:24:21 +05:30
Shrikant Sharat Kandula
25b752843f
Auto-login on signup (#201)
* Auto-login on signup works!

* Support form-encoded data body for signup requests

* Remove debug log entry when getting session

* Refactoring and add some docs to UserSignup solution

* Move user object construction to UserSignup solution

* Redirect with error message on signup errors
2020-08-10 14:59:56 +05:30
Shrikant Sharat Kandula
b511c3ada9
Change return type of plugin execution to be more specific (#247) 2020-08-10 14:41:32 +05:30
Trisha Anand
b5841e96d2
GET plugin form now returns json to render both datasource configuration form and the editor query pane (#199)
Keeping the function to read plugin resource generic for any type of resource. Now the parent function can also conditionally decide which plugin would require to read which resources from the filesystem.

Co-authored-by: Arpit Mohan <arpit@appsmith.com>
2020-08-03 16:37:28 +05:30
Shrikant Sharat Kandula
cef1241bcb
Return 200 when action could not be executed (#202) 2020-08-03 07:35:14 +05:30
Shrikant Sharat Kandula
43304ca146
Fix form data not showing up in the right place when importing from curl (#198) 2020-07-30 16:30:39 +05:30
Trisha Anand
c6a9fc2bb4
Organization getById should use custom repository get function (#195)
* Overwriting the base service's getById for OrganizationService to ensure that the response contains userPermissions (by using custom repository instead of default mongo repository classes)

* Fixed the failing test cases.

* Minor code formatting.
2020-07-29 16:57:46 +05:30
Arpit Mohan
4475bc2b1e
Configuring dynamic redirect post login (#194)
The client will have to send a query parameter redirectUrl or a header X-Redirect-Url in order for the server to redirect the client to the appropriate URL post login. If neither of these parameters are present, the client is redirected to /applications by default.

Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
2020-07-29 16:07:40 +05:30
Trisha Anand
eba38ae1fa
During signup, if the user already exists, instead of throwing a generic duplicate key exception, request the user to sign in. (#192)
* During signup, if the user already exists, instead of throwing a generic duplicate key exception, request the user to sign in.

* Minor change in the error message.
2020-07-29 13:44:23 +05:30
Shrikant Sharat Kandula
60efdb998b
Fix: Datasource password gets double encrypted on cloning (#191)
* Decrypt sensitive fields before cloning a datasource

* Fix NPE in cloning datasource when configuration is missing
2020-07-29 11:12:04 +05:30
Trisha Anand
9c51ac3f8d
🔥 & forget asynchronous email sending (#187)
* Email sending is now an asynchronous function. It follows a 🔥 & forget strategy to make it run asynchronously.
2020-07-28 20:06:12 +05:30
Shrikant Sharat Kandula
66bf23106d
Fix cloning fails in some cases for organizations (#159)
* Fix cloning fails in some cases for organizations

Cloning currently fails in cases like the following:
- Application with no pages
- Pages with no actions
- Pages with more than one action

* Remove debug naming of cloned datasources

* Add test for organization cloning

* Add more tests for organization cloning

* Fix potential race condition in adding pages to an application

* Move db update call to add page to application, into repository

* Use `getIdCriteria` to query for document's _id
2020-07-28 17:54:06 +05:30
Shrikant Sharat Kandula
74da0f117e
Reuse layout that's automatically created with page (#163)
* Reuse layout that's automatically created with page

* Use correct API for updating a layout

* Commenting out organization cloning test.

* Removed organization cloning test

* Adding a dummy commit to run the pipeline.

Co-authored-by: Arpit Mohan <arpit@appsmith.com>
2020-07-25 18:13:29 +05:30
Shrikant Sharat Kandula
10ad639b28
Bug/layouts not updated on action change (#161)
* Fix layouts not be updated when an action is updated

* Add test for updating onLoadActions when action updated

* Split layout and action test to separate class

* Remove duplicated test in ActionServiceTest
2020-07-25 16:45:42 +05:30
Shrikant Sharat Kandula
5ee1c24224
Fix layouts not be updated when an action is updated (#160)
* Fix layouts not be updated when an action is updated

* Add test for updating onLoadActions when action updated
2020-07-25 15:43:22 +05:30
Shrikant Sharat Kandula
4a269efd4a
Reset default fields of User object before update (#158)
The policies of `User` objects is an empty set by default. So, when using a new `User` object to call `update`, it also updates existing policies to be an empty list.
2020-07-24 18:32:43 +05:30
Trisha Anand
9f8b5ca4d8
Adding execute action permissions policy to match read actions policy in existing actions. (#156)
* Fixing test cases failing due to non unique names.

* Adding execute action permissions policy to match read actions policy in existing actions.

* Only save the action if there are read actions permission present (and hence could have been updated)
2020-07-24 17:05:49 +05:30
Trisha Anand
61c62c9212
Datasource Test should test against the datasource object sent by the client (#155)
* Datasource test should always test the latest object given by the client (instead of fetching the same from the db). If it is a saved datasource, then we should decrypt and set the password in the datasource (unless the password is one of the changes that is being tested).

* Added function level comment to clarify that this function can no longer be used by just sending the datasource.id field set.
2020-07-24 15:53:40 +05:30
Shrikant Sharat Kandula
23dd84d9c8
Clear application pages list before cloning (#154) 2020-07-24 14:35:16 +05:30
Shrikant Sharat Kandula
dfcabab4cc
Handle stale database connection from datasources (#151)
* Handle stale database connection from datasources

* Fix potential secondary case of stale connection error

* Fix Postgres to MySQL

* Move validity check timeout to a constant field

* Add test for recovery when stale connection error is thrown
2020-07-24 12:18:25 +05:30
Arpit Mohan
36bf14f221
Adding dynamic redirect to form & OAuth2 login (#149)
The client can send the redirect URL in X-Redirect-Url header. The server will honour the value set and redirect the client browser to this particular url. By default the server will redirect to /applications if the custom header is missing. The redirect url can either be absolute or relative.

Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
2020-07-23 20:32:38 +05:30
Trisha Anand
3c30b38937
Bug fix : External datasources do not execute for public application (#143)
1. Bug fix for when actions for a public application use an external datasource (aka db queries). The db queries were not getting executed because the permission for execute datasource was not getting set for anonymousUser.

2. When using the Test endpoint for datasource, if the datasource is being read from the db and there are encrypted fields, first decrypt the field and then send to the plugin for testing the co
2020-07-23 20:31:36 +05:30
Shrikant Sharat Kandula
fd888e33c8
Add migration for updating plugin doc links to our own docs (#142) 2020-07-22 15:28:27 +05:30
Arpit Mohan
690c327f2c
Adding default values for mysql datasource (#140)
Also correcting icon details to mysql plugin migration.
2020-07-22 14:00:15 +05:30
nupur
d0e60a1890
Mysql plugin integration (#53)
This commit adds the Mysql plugin to the Appsmith server. We also add a migration to ensure that this plugin is installed by default for all existing organizations. The migration also adds the plugin details into the DB.

Also adding the test cases for mysql plugin.

Co-authored-by: Arpit Mohan <arpit@appsmith.com>
Co-authored-by: Hetu Nandu <hetu@appsmith.com>
Co-authored-by: Arpit Mohan <me@arpitmohan.com>
Co-authored-by: Nupur Singhal <nupursinghal@Nupurs-MacBook-Air.local>
2020-07-21 16:01:42 +05:30
Shrikant Sharat Kandula
1fc582af08
When cloning examples organization, clone only public applications (#125)
* When cloning examples organization, clone only public applications

* Create template organization within the test

* Cleaned up test for cloning of examples organization

* Fix Mono chaning

Co-authored-by: Trisha Anand <trisha@appsmith.com>

* Create test apps and config simultaneously

Co-authored-by: Trisha Anand <trisha@appsmith.com>
2020-07-21 13:39:07 +05:30
Trisha Anand
d1dd74018f
Bug fix : Update of datasource object leads to authentication field getting encrypted again. (#124)
* Datasource authentication object fields should only be encrypted during create or if the update object contains authentication object. Added a test case to check that update to any other field doesnt update the encrypted fields.

* Incorporated review comment
2020-07-21 10:53:03 +05:30
Shrikant Sharat Kandula
55a6cc6614
Clone examples organization for every new user (#78)
* Trying to clone the examples repo on new user signup

* Working implementation of cloning examples organization on user sign up

* Fix personal org not being created when template org is missing

* A working version of cloning of examples organization on first-login

* Add docs for methods in ExamplesOrganizationCloner

* Refactor computing user's first name into a method

* Add some menial tests for examples organization cloning

* Use explicit permissions when fetching applications and datasources

* Fix template organization config name hard-coding
2020-07-20 13:07:31 +05:30
Shrikant Sharat Kandula
f9e1d4f1ad
Chore/remove implicit permissions (#90)
* Refactor implicit permissions in service methods as function arguments

* Revert an unintended change that got committed

* Fix permission variable name

Co-authored-by: Trisha Anand <trisha@appsmith.com>

Co-authored-by: Trisha Anand <trisha@appsmith.com>
2020-07-20 13:06:47 +05:30
Shrikant Sharat Kandula
140bfed24f
Disable the direct create methods for pages and applications (#109)
* Disable the direct `create` methods for pages and applications
* Create differently named versions of create methods to avoid ambiguity
* Removed unused pageService in DatasourceServiceTest
* Rename createPlain method to createDefault to better convey intent
2020-07-16 15:13:03 +05:30
Trisha Anand
04db3d4242
Bug Fix : Execute Action is not open for execution in public application. (#105)
* Opening the execute path & fetching db without permissions during execute path.
2020-07-15 21:36:35 +05:30
Trisha Anand
936c013b3b
Bug fixes : 401 for public applications + Empty set of actions for get in case cookies is anonymous (#104)
* Bug fixes :
1. Get actions in view mode should be open for unauthorized requests. Fixed that.
2. set transient fields in action is called post fetching all the actions (after taking care of all the permissions). At this point, we shouldnt be using permissions to fetch datasource.
2020-07-15 20:15:10 +05:30
Trisha Anand
20ae5fa546
Adding timeout in ActionViewDTO for the client to use to programmatically timeout on the execution request (#103)
* Adding timeout in ActionViewDTO for the client to use to programmatically timeout on the execution request.
2020-07-15 18:44:55 +05:30
Trisha Anand
6bfed87e40
Added pageId to action view dto (#101)
* Added pageId in the ActionViewDTO and NPE check for setting the json path keys.

* Checking for both json path keys being null and not empty before copying the json path keys into action view dto.
2020-07-15 17:53:38 +05:30
Trisha Anand
212e98c4ba
Fixing test cases failing due to non unique names. (#100) 2020-07-15 16:42:53 +05:30
Arpit Mohan
6c16cba4b9
Adding null checks before encrypting or decrypting the password in AuthenticationDTO object (#99)
This ensures that we don't run in NPE
2020-07-15 16:29:05 +05:30
Arpit Mohan
c15f83dbc3
Adding configuration variables for MAIL_FROM and REPLY_TO in EmailConfig (#97)
The MAIL_FROM & REPLY_TO addresses default to appsmith@localhost. This should be changed in the generated docker.env file during deployment to actual values.

Most email providers will not send emails unless they originate from a valid sender ID.
2020-07-15 15:47:33 +05:30
Trisha Anand
fd0f23b9cc
Database credentials encryption in MongoDB (#80)
* Encrypting the password stored in AuthenticationDTO for every db.

* Adding comment to the properties file to denote that adding encryption salt and password are mandatory to the server coming up.

* Added the encryption salt and password to server.yml to allow the github actions to succeed.

* Adding database migration to encrypt the existing passwords for authentication object (used for storing db connection username/password)

Changes to the installation script install.sh:

1. Instead of overwriting the existing encryption password or salt, giving the user an option to conserve the previous encryption credentials to ensure that the developer users do not lose access to their database configurations (passwords).
2. Added another file for writing encryption credentials (encryption.env) to ensure that we dont delete the encryption password and salt by mistake.
2020-07-14 14:45:08 +05:30
Trisha Anand
56acb5c9fd
New endpoint added to get actions by applicationId in view mode. (#88)
* New endpoint added to get actions by applicationId in view mode. Only id, name and jsonPathKeys are returned in view mode.
2020-07-13 23:27:49 +05:30
Trisha Anand
4a720b80e2
Removing the marketplace basic auth credentials which was hard coded into the code to environment variable. (#71) 2020-07-09 22:38:21 +05:30
Trisha Anand
8734067cad
Resolving the dependabot vulnerabilities. (#69) 2020-07-09 21:12:16 +05:30
trishaanand
9eedb15620
Updating anonymous user permissions for application and associated pages & actions when public access is modified (#57)
* On setting an application to public view, correct permissions are assigned to the application and its pages & actions.

* If anonymous user is allowed a certain permission, the all users (anonymous/logged in) should be allowed the certain permission.
2020-07-09 11:21:39 +05:30
trishaanand
53b61b4942
Skeleton code added for changing application view between public and private to help with client development. (#56) 2020-07-08 17:13:42 +05:30
trishaanand
a5a3a5f4a2
Bug fix - In case of invited user signing up on Appsmith, the password is getting doubly hashed leading to sign in breaking for this user. (#51)
* Bug fix is working. Added a test case which is not working.

* Code cleanup. Test case fixed. Now, when we set the user to enabled, we also store the password that has been passed to the flatMap.

* Minor code cleanup.
2020-07-08 13:16:13 +05:30
trishaanand
765f1c7164
Get user profile should return anonymousUser instead of 401 unauthorized in case the API is called without logging in. (#50)
This will help us display the 404 page on the client reliably.
2020-07-08 11:54:00 +05:30
trishaanand
c9703ea3b1
Special 404 handling and adding a few paths to the unauthenticated list to allow for public applications (#45)
* 404 error added for a few API calls which would be specially handled on the frontend to display an ACL 404 error.

* Putting everything except GET actions, GET pages, and GET applications behind authenticated. This ensures that in the future public applications (view only) would not lead to 401 but any other page would.

* Code formatted.
2020-07-06 20:21:07 +05:30
Shrikant Sharat Kandula
56547ec02f
Move application configuration to be loaded from environment variables (#23)
* Move application configuration to be loaded from environment variables
* Remove unused sentry.properties
* Make missing value sentinel a constant and ignore all *.env files
* Removed now-used ACL properties
* Prefix RapidAPI environment variable with APPSMITH_
* Fix application properties not being loaded into static fields
* Remove application-test.properties file
* Add required env variables for test in GitHub
* Quote URLs for MongoDB and Redis in test config
* Change RAPIDAPI to RAPID_API in environment variable names
* Source .env file in the root of repo in start script
2020-07-06 14:35:56 +05:30
trishaanand
4a05ba6ac5
An invited user on signup should be set to enabled and should not lead to duplicate key exception. (#36) 2020-07-06 12:46:46 +05:30
Arpit Mohan
3035ec9bef
Adding the Github action workflow for the server code (#24)
* Adding the Github action workflow for the server code

* Modifying the redis endpoint in application-test.properties to point to localhost because the Docker service exposes ports to the host
2020-07-03 14:40:57 +05:30
Arpit Mohan
fdeed757ff
Fixing the move action API by removing invocations to subscribe (#17)
* Fixing the move action API by removing invocations to subscribe

Calling subscribe() inside function calls is an anti-pattern and we shouldn't be doing it.
The reactiveContext is not called if the subscribe() function is called in the middle of execution flows. This breaks DB queries.

* Added test case for move action.

Co-authored-by: Trisha Anand <trisha@appsmith.com>
2020-07-02 15:41:45 +05:30
Shrikant Sharat Kandula
95b9860bf9
Give appropriate error when method is invalid in cURL command (#1) 2020-07-01 12:37:59 +05:30
Trisha Anand
930e577f98 Bug Fix : When page name is updated, the policies should not get overwrritten. Changed the base service function to reset the empty policies to null in case the update is not used to update the policies. 2020-06-27 19:45:24 +00:00
Trisha Anand
76e3db497c Bug fix : Google SSO for sign up led to the organization id for personal organization not getting set up. 2020-06-26 11:59:33 +00:00
Arpit Mohan
bbf0aef450 Merge branch 'bug/embedded-datasource-without-organization-id' into 'release'
When organizationId is null in a datasource, fail with the right error message

The organization id is subsequently used to find a matching plugin (checking for installation essentially), but when organization id is missing, this query never returns. But the error message reads as if the plugin is not installed, whereas it should've been that organization id is missing.

See merge request theappsmith/internal-tools-server!406
2020-06-26 11:43:16 +00:00
Shrikant Kandula
d5921ea52d When organizationId is null in a datasource, fail with the right error message 2020-06-26 11:43:16 +00:00
Trisha Anand
779c79476d Merge branch 'bug/acl-update-role-race-condition' into 'release'
Race condition bug caught in remove user from organization flow where multiple applicaitons/pages/actions exist for an organization.

See merge request theappsmith/internal-tools-server!407
2020-06-25 10:15:07 +00:00
Trisha Anand
57f4f734dd Race condition bug caught in remove user from organization flow where multiple applicaitons/pages/actions exist for an organization. 2020-06-25 15:39:32 +05:30
Shrikant Kandula
3217daab14 Fix Mustache rendering to work on object fields directly 2020-06-25 09:58:20 +00:00
Trisha Anand
6d103b4939 Untested changes for fixing the bug where duplicate policies are getting created for the same permission. 2020-06-25 08:09:59 +00:00
Trisha Anand
a73d182d73 Merge branch 'bug/org-creation' into 'release'
Bug fix : Create Organization is failing because the user is read from the session and not from the repository. Now reading the user at appropriate places.

See merge request theappsmith/internal-tools-server!405
2020-06-24 12:14:25 +00:00
Trisha Anand
aebb50d216 Bug fix : Create Organization is failing because the user is read from the session and not from the repository. Now reading the user at appropriate places. 2020-06-24 17:30:24 +05:30
Arpit Mohan
b63ca6726d Merge branch 'feat/plugin-templates' into 'release'
Add server-side templates support for plugins

Two main themes in this MR:

1. Add support for saving query templates as resource files inside a plugin. This has been done for both Postgres and MongoDB plugins, based on current template contents.
2. Loading of form JSON is now reactive. The blocking call has been moved inside a `Mono.fromSupplier`.
3. The loading of from JSON as well as the templates is cached and are loaded on-demand. This means that the templates are loaded once for a plugin through the lifetime of the server process, and that they are loaded only at the first time they are needed.
4. If loading of these resources fails, we try again when they are needed the next time.

See merge request theappsmith/internal-tools-server!385
2020-06-24 11:08:25 +00:00
Shrikant Kandula
eee2cfcaff Add server-side templates support for plugins 2020-06-24 11:08:25 +00:00
Shrikant Kandula
d7655ebb3c Add image location and documentation link fields to plugins 2020-06-24 08:28:54 +00:00
Arpit Mohan
0be492e8e9 Fixing OAuth2 SSO login for new ACL flow 2020-06-23 13:19:22 +00:00
Trisha Anand
0603da29ee User test - Add request URL and http method to the execution result 2020-06-19 16:24:58 +00:00
Shrikant Kandula
5ce19962a3 Merge branch 'chore/sending-email-should-be-nonblocking' into 'release'
Sending emails is now done in a non-blocking way

See merge request theappsmith/internal-tools-server!396
2020-06-19 07:14:43 +00:00
Shrikant Kandula
5f0a3034b8 Sending emails is now done in a non-blocking way 2020-06-18 17:29:36 +05:30
Shrikant Kandula
70c312ca40 Merge branch 'bug/disallow-delete-datasource-with-actions' into 'release'
Fail deleting datasource if there's actions against it

See merge request theappsmith/internal-tools-server!388
2020-06-18 10:41:49 +00:00
Shrikant Kandula
9f6a4f6ea5 Fail deleting datasource if there's actions against it 2020-06-18 10:41:48 +00:00
Shrikant Kandula
45961ddcde Merge branch 'bug/fail-on-invalid-page-id-when-creating-action' into 'release'
Fail with an error if can't find page when creating an action

See merge request theappsmith/internal-tools-server!394
2020-06-18 10:25:13 +00:00
Trisha Anand
63852041de Merge branch 'bug/delete-application-app-viewer' into 'release'
Bug Fix : Application and page can only be deleted if you have manage application/page permissions respectively.

See merge request theappsmith/internal-tools-server!395
2020-06-18 10:20:50 +00:00
Shrikant Kandula
f19764ab99 Merge branch 'bug/space-not-needed-in-header-in-curl' into 'release'
Fix parse error when there's a space in header in curl command

See merge request theappsmith/internal-tools-server!390
2020-06-18 10:11:39 +00:00
Trisha Anand
4337e88934 Application and page can only be deleted if you have manage application/page permissions respectively. 2020-06-18 15:35:30 +05:30
Shrikant Kandula
1d5fa960db Fail with an error if can't find page when creating an action 2020-06-18 15:05:55 +05:30
Trisha Anand
ec8c63bfee For invitation, throw a bad request error in case all the invite dto fields are not set. 2020-06-18 14:05:48 +05:30
Trisha Anand
e5282dac11 In case a page is opened in edit mode, it should open with permission of MANAGE_PAGE. In case the user is a viewer, the page must not open. 2020-06-17 17:34:26 +05:30
Trisha Anand
893698f09e Merge branch 'release' into feature/acl-spring-object
# Conflicts:
#	appsmith-server/src/main/java/com/appsmith/server/constants/FieldName.java
2020-06-17 15:10:23 +05:30
Trisha Anand
8fc99cf0bd In case a user is invited to an organization as developer, correct top permissions are being assigned via Appsmith role. 2020-06-17 09:33:00 +00:00
Shrikant Kandula
8e40240f25 Fix parse error when there's a space in header in curl command 2020-06-17 12:32:08 +05:30
Arpit Mohan
c6af229a97 Merge branch 'bug/default-page-action-refactor' into 'release'
Adding the widget names set to the default layout for a page

During action name refactor, we require the widget names to exist in the layout. Hence all default layouts must have the widgetName set.

See merge request theappsmith/internal-tools-server!387
2020-06-16 05:25:54 +00:00
Arpit Mohan
a4132d5845 Adding the widget names set to the default layout for a page 2020-06-16 10:50:07 +05:30
Shrikant Kandula
dd0ba857c2 Fix cURL import when using --url argument
Also fixes cases where there's a space between `-X` and `POST` and
similar cases.
2020-06-16 09:59:43 +05:30
Trisha Anand
9dfb72720e Fixed the broken test cases. 2020-06-12 19:35:01 +05:30
Trisha Anand
bb6dc61015 Build fix 2020-06-12 19:16:31 +05:30
Trisha Anand
73757c3425 Merge branch 'release' into feature/acl-spring-object
# Conflicts:
#	.gitignore
#	appsmith-plugins/mongoPlugin/plugin.properties
#	appsmith-plugins/postgresPlugin/plugin.properties
#	appsmith-plugins/rapidApiPlugin/plugin.properties
#	appsmith-plugins/restApiPlugin/plugin.properties
#	appsmith-plugins/restApiPlugin/src/main/java/com/external/plugins/RestApiPlugin.java
#	appsmith-server/src/main/java/com/appsmith/server/constants/FieldName.java
#	appsmith-server/src/main/java/com/appsmith/server/repositories/ActionRepository.java
#	appsmith-server/src/main/java/com/appsmith/server/services/ActionServiceImpl.java
#	appsmith-server/src/main/java/com/appsmith/server/services/DatasourceContextServiceImpl.java
#	appsmith-server/src/main/java/com/appsmith/server/services/DatasourceServiceImpl.java
#	appsmith-server/src/test/java/com/appsmith/server/services/ActionServiceTest.java
#	appsmith-server/src/test/java/com/appsmith/server/services/ApplicationServiceTest.java
#	appsmith-server/src/test/java/com/appsmith/server/services/LayoutServiceTest.java
#	appsmith-server/src/test/java/com/appsmith/server/services/PageServiceTest.java
#	build.sh
2020-06-12 19:14:31 +05:30
Shrikant Kandula
b391f46e2c ACL Migration Script 2020-06-12 11:54:21 +00:00
Trisha Anand
4eab663c8e Bug fix for forgot password error "user not found". During reset password, the user is not logged in and hence the permissions can not be applied during repository findByEmail 2020-06-12 13:57:57 +05:30
Trisha Anand
3dafccba2e In case of sending email for an existing user, fixed the URL. 2020-06-12 13:30:53 +05:30
Shrikant Kandula
ab83bc0223 Fix problem where not all apps were getting policies when invited. 2020-06-11 20:56:52 +05:30
Trisha Anand
e7e008dcd2 Fixed the repository function which was failing for fetching actions during updateLayout. 2020-06-11 07:22:16 +00:00
Arpit Mohan
01737b9599 Experimenting with maven-shade-plugin to create a fat-jar of the postgres dependency.
Will have to do this for all plugins. Currently, it's not registering the plugin with the SpringPluginManager
2020-06-10 11:11:23 +00:00
Shrikant Kandula
1ce336257c Mark any 2xx status code in REST API plugin as successful execution. 2020-06-10 10:51:07 +00:00
Trisha Anand
7a658ce5ea App viewer user in an organization should have read:organizations permission. 2020-06-10 15:55:29 +05:30
Trisha Anand
491afc3599 In case of global datasource, no need to check for organizationId during action create. 2020-06-10 09:08:01 +00:00
Trisha Anand
a89355a5ec Fixes bugs : 1. read:datasource permission should not be applied to application; 2. A user shouldn't be added to an organization if the user already exists in the organization. 2020-06-10 06:22:16 +00:00
Arpit Mohan
3cf8ff008f Hacky fix for the postgres plugin to work. Including the dependency in the appsmith-server/pom.xml file instead of the plugin 2020-06-10 10:46:09 +05:30
Trisha Anand
ac06cc9668 1. user permissions during create/update of actions and datasources would now be set.
2. During update, policies are set to null in the update object to ensure that the policies are not overwritten to empty set.
2020-06-09 20:25:13 +05:30
Arpit Mohan
bbd33c2968 Removing the query field in ActionConfiguration and using String body as the field to store the query
This is to simplify the query pane on the frontend client. The client doesn't need to have separate interfaces for sql and non-sql plugins. All queries will be sent to the server in the form of a String that is parsed in different formats based on the plugin.

Also adding test cases for PostgresPlugin. Used TestContainers to simulate the postgres db in Docker inside the Java test itself. Very useful.
2020-06-09 12:12:27 +00:00
Trisha Anand
061577d2c9 Bug : When the user tries to invite without selecting the role user, this leads to null pointer exception.
Fix : A user CAN NOT be invited to an organization without specifying the role.
2020-06-08 14:56:12 +00:00
Trisha Anand
a888d54059 Changed the get all actions function to fix the bug where find by Example is not working. Instead the same has now been implemented using criteria. 2020-06-08 12:05:49 +00:00
Trisha Anand
9ac7e817cc Merge branch 'feature/acl-remove-getCurrentOrganization' into 'feature/acl-spring-object'
Removed the usage of get current organization id. Added organization id to a few api calls.

See merge request theappsmith/internal-tools-server!367
2020-06-08 06:45:04 +00:00
Trisha Anand
a31796a216 Removed the usage of get current organization id. Requires addition of organization id to a few api calls. 2020-06-08 06:45:04 +00:00
Trisha Anand
f9d63f9881 Adding a 3P Api to a page now also expects the client to send the organization id. 2020-06-05 16:14:15 +05:30
Trisha Anand
87aafd6cf4 Adding test case for testDatasource
Refactoring the testDatasource code by moving the business logic to the service layer.
2020-06-05 10:05:23 +00:00
Arpit Mohan
1a68b7f561 Fixing the DSL Json for default layouts in new pages. 2020-06-04 16:13:47 +05:30
Trisha Anand
9e1742c289 Add OrgId to the output of the api used to return all the page ids and names given an application (id or name) 2020-06-04 08:08:15 +00:00
Arpit Mohan
1ac69bab50 Modifying the default page name to Page1
Also creating a default empty layout when a new page is created. This ensures that the client can show the default message on new page creations.
2020-06-04 13:05:34 +05:30
Trisha Anand
f8cf87e3c8 Invite existing user to an organization works. Updated the test case for adding user to an organization as well to use the new API. 2020-06-01 17:39:27 +00:00
Trisha Anand
f1e1e6959a Bug : New users aren't able to read their own user object and hence homepage doesnt load.
Fix : Added lateral permissions for user on create.
2020-05-29 05:28:30 +00:00
Trisha Anand
d6670c70cc Bug Root Cause : New users have no applications inside the organizations(s). In this case, get all applications does not return back organizationApplications object.
Fix : In getAllApplications, instead of iterating over collections of applications which could be empty, we iterate over organizations where we are guaranteed to have atleast one organization.
2020-05-28 13:31:24 +05:30
Trisha Anand
6475be63d1 Baseline code added for cascading the org level permissions to applications, pages and eventually actions. 2020-05-27 14:36:57 +00:00
Arpit Mohan
d20e92a587 Modifying the Action object to include an array of Property for dynamicBindingPathList 2020-05-27 13:16:38 +05:30
Arpit Mohan
9f82bde92c Adding statusCode from AppsmithPluginErrors when plugins error out
This ensures that we can always display a status code on the client.
2020-05-26 11:50:09 +00:00
Trisha Anand
59a83d414b Added description to roles for organization appsmith roles. 2020-05-26 10:49:42 +05:30
Arpit Mohan
a569156029 Merge branch 'hotfix/action-error' into 'release'
Creating the actionExecutionResult object for error scenarios as well.

See merge request theappsmith/internal-tools-server!354
2020-05-23 07:23:13 +00:00
Arpit Mohan
e6b7ffca9c Creating the actionExecutionResult object for error scenarios as well.
This ensures that we can populate the request fields for all action executions
2020-05-23 12:49:01 +05:30
Trisha Anand
0c9c95bc9a Fixed the findAll repository function which was leading to get all actions via application id to throw an internal server error. 2020-05-22 15:56:09 +05:30
Trisha Anand
d98fce3d09 WIP: adding helper functions for adding/removing roles from an organization. Adding role updates the organization right now. Removing role -> added a helper.
TODO : finish the above code flows + cascade these to the children objects of the organization -> Applications/Pages/Actions.
2020-05-21 15:05:43 +00:00
Shrikant Kandula
7037d99cfa Use sequences for numbering new datasources. 2020-05-20 11:21:32 +00:00
Trisha Anand
e95b680169 create application now expects organization id. Fixed the test cases which broke because of this basic change in the way applications are created. 2020-05-19 17:09:51 +00:00
Shrikant Kandula
b13a7a5df3 Fix incorrect call to updatedAt. 2020-05-19 19:25:32 +05:30
Shrikant Kandula
329587f5ff Fix NPE when using datasources without updatedAt. 2020-05-19 13:48:58 +00:00
Arpit Mohan
14c1778645 Merge branch 'bug/curl-auto-add-protocol' into 'release'
Automatically add protocol to URL provided to cURL command.

Notion ref: <https://www.notion.so/appsmith/CURL-import-for-incomplete-but-valid-URLs-like-www-google-com-leads-to-the-URL-not-getting-read-Th-9191456cb1b24cd68b92072c1a6f3ab6>.

See merge request theappsmith/internal-tools-server!343
2020-05-19 04:23:59 +00:00
Shrikant Kandula
db0532941d Automatically add protocol to URL provided to cURL command. 2020-05-19 04:23:58 +00:00
Arpit Mohan
85ea6563db Merge branch 'hotfix/server-use-forward-headers' into 'release'
Adding the ForwardedHeaderTransform bean to enable spring to parse...

Adding the ForwardedHeaderTransform bean to enable spring to parse X-Forwarded-* headers from Nginx proxy

See merge request theappsmith/internal-tools-server!344
2020-05-19 03:56:40 +00:00
Arpit Mohan
158f5c8203 Adding the ForwardedHeaderTransform bean to enable spring to parse X-Forwarded-* headers from Nginx proxy 2020-05-19 09:22:33 +05:30
Shrikant Kandula
bffd68b1a9 Merge branch 'bug/postgres-empty-result' into 'release'
Don't fail after executing a non-SELECT query on Postgres.

See merge request theappsmith/internal-tools-server!341
2020-05-18 13:42:24 +00:00