Commit Graph

49 Commits

Author SHA1 Message Date
Dave Page
ea4dbd31e8 Don't try to set permissions on Windows. It won't work anyway. Fixes #4276 2019-05-20 13:53:08 +01:00
Dave Page
d728ee7436 Ensure sanity of the permissions on the storage and session directories and the config database. Fixes #4182 2019-04-17 16:57:34 +01:00
Dave Page
73b144c45c Fix an issue where importing servers fails if a group already exists for a different user. Fixes #4022 2019-02-21 15:40:37 +00:00
Murtuza Zabuawala
e23d307c56 Update copyright notices for 2019 2019-01-02 15:54:12 +05:30
Dave Page
f0327f5219 Add the ability to import and export server definitions from a config database. Fixes #3772 2018-11-21 16:09:20 +00:00
Murtuza Zabuawala
393ce53d2d Fix PEP8 issues in the Tools module. Fixes #3063 2018-01-26 16:54:21 +00:00
Dave Page
89821c0d19 Update copyright notices for 2018. 2018-01-05 10:42:50 +00:00
Surinder Kumar
7835da267b Allow pgAdmin to run with config database versions from the future. Fixes #2664 2017-08-29 15:03:02 +01:00
Dave Page
a65f7b330b Ensure builtins.SERVER_MODE is handled if running setup.py standalone. 2017-08-25 11:56:44 +01:00
Ashesh Vashi
b095d1f33a Ensure the initial password is properly hashed during setup in web mode. Fixes #2492 2017-07-10 16:08:35 +01:00
Khushboo Vashi
1ee555e468 Ensure the feature tests use the correct test settings database. Fixes #2486 2017-06-16 10:17:38 +01:00
Sarah McAlear
6283ef7f5e [Configuration][Migration] Use 'alembic' for migration of the SQLite
based configuration file from one version to another, and also allows us
to have a single path of creating the table instead of creating tables
using SQLAlchemy or hand rolled SQL

This allows us to run the migrations directly in the code, and it will
avoid the error prone version numbering.

Patched by: Sarah McAlear
Revisions: Joao Pedro De Almeida Pereira, George Gelashvili.
Reviewed by: Ashesh Vashi, Murtuza Zabuawala
2017-04-24 08:37:27 +05:30
Ashesh Vashi
f2fc1ceba8 Resolved quite a few file-system encoding/decoding related cases.
In order to resolve the non-ascii characters in path (in user directory,
storage path, etc) on windows, we have converted the path into the
short-path, so that - we don't need to deal with the encoding issues
(specially with Python 2).

We've resolved majority of the issues with this patch.
We still need couple issues to resolve after this in the same area.

TODO
* Add better support for non-ascii characters in the database name on
  windows with Python 3
* Improve the messages created after the background processes by
  different modules (such as Backup, Restore, Import/Export, etc.),
  which does not show short-paths, and xml representable characters for
  non-ascii characters, when found in the database objects, and the file
  PATH.

Fixes #2174, #1797, #2166, #1940

Initial patch by: Surinder Kumar
Reviewed by: Murtuza Zabuawala
2017-03-07 15:31:03 +05:30
George Gelashvili
19be3529f8 Create a template loader for SQL templates.
This will automatically find the correct version of a template for the server version, and allows us to remove templates that were previously duplicated for different server versions.

Patch by George & Tira at Pivotal. Review by me and Murtuza from EDB.

Discussion: https://www.postgresql.org/message-id/flat/CAHowoHaU9_pkCt%2B1g8dpY3hsXXZmsJZiJH-3-_Hd%2BC1MxiGhtA%40mail.gmail.com#CAHowoHaU9_pkCt+1g8dpY3hsXXZmsJZiJH-3-_Hd+C1MxiGhtA@mail.gmail.com
2017-01-30 11:25:03 +00:00
Dave Page
f221194bcc Update copyright notices for 2017. 2017-01-04 13:33:32 +00:00
Ashesh Vashi
d4c439d64a Ensure the auto-generated CSRF_SESSION_KEY, SECRET_KEY,
SECURITY_PASSWORD_SALT keys are decoded as string for python 3
compatibility.

Fixes #1871
2016-10-20 13:16:31 +05:30
Ashesh Vashi
19df1e3f4b Ensure SECURITY_PASSWORD_SALT is set to something when initialising (to avoid errors, prior to being set to the 'real' value). Fixes #1871 2016-10-19 14:04:07 +01:00
Dave Page
bc5cc964a3 Move security keys into the SQLite database, and auto-generate them.
This avoids packagers having to deal with the issue, which can be
difficult if they need to cater for both server and desktop modes.

Fixes #1849
2016-10-19 09:22:38 +01:00
Dave Page
7175929cab Ensure that the directory paths are as they should be under the runtime. Note that this change requires (for now) the regression tests to be run from the web/regression directory. 2016-09-26 16:38:27 +01:00
Navnath Gadakh
d3d8836f61 Introduce a test config database for the regression tests, and track/remove objects that are created during testing. 2016-09-14 16:26:12 +01:00
Dave Page
60659975ed Stop using deprecated imports. 2016-07-22 16:25:23 +01:00
Dave Page
d79524ff60 Require passwords to be at least 6 chars long in setup.py. Fixes #1322 2016-06-30 14:16:30 +01:00
Dave Page
71443deceb Fix email validation 2016-06-30 09:46:06 +01:00
Dave Page
d63b54610b Move the config database schema version out of the configuration file and into the model class.
Turns out using the config file isn't a good idea if users copy config.py to config_local.py, as it prevents upgrades to the database. This has the added side-effect of simplifying future changes, as you only need to edit 2 files to modify the config DB now, not 3.
2016-06-24 12:50:52 +01:00
Dave Page
1acc1a7678 Auto-discover locally installed servers at login. Fixes #1389 2016-06-23 16:27:06 +01:00
Murtuza Zabuawala
97d49af43a Fix constraint on server table to allow port 65535 to be used. Fixes #1388 2016-06-23 11:43:50 +01:00
Dave Page
7d0fe669ca Code tidy. 2016-06-21 14:21:06 +01:00
Dave Page
3026b470e9 Optimise Python imports. 2016-06-21 14:12:14 +01:00
Harshal Dhumal
6cfa022e35 Validate email addresses when creating the config DB. 2016-06-10 16:19:46 +01:00
Harshal Dhumal
e3ab4501d5 User management. 2016-06-06 13:34:08 +01:00
Ashesh Vashi
f682f06c94 Adding a background process executor, and observer.
We will be using the external utilities like pg_dump, pg_dumpall,
pg_restore in background. pgAdmin 4 can be run as a CGI script, hence -
it is not good idea to run those utility in a controlled environment.
The process executor will run them in background, and we will execute
the process executor in detached mode.

Now that - the process executor runs in detached mode, we need an
observer, which will look at the status of the processes. It also reads
output, and error logs on demand.

Thanks - Surinder for helping in some of the UI changes.
2016-05-13 08:49:51 +05:30
Neel Patel
12ae40fe62 Procedural language debugger. 2016-04-14 21:36:04 +01:00
Ashesh Vashi
3c366fafe7 Server side session management support. 2016-03-22 15:05:43 +00:00
Dave Page
5ea822f33e Preferences dialogue. Patch by Ashesh and Khushboo Vashi. 2016-03-07 11:48:53 +00:00
Dave Page
694506453b Copyright updates for 2016. 2016-01-18 14:48:14 +00:00
Murtuza Zabuawala
a04ef2de43 Fixed an issue related taking input as raw_input on Python 2.
This is regression, introduced in the commit-id:
209ee78b25
2015-12-04 15:37:06 +05:30
Murtuza Zabuawala
209ee78b25 First round of Python 3 compatibility fixes. 2015-11-06 10:23:19 +00:00
Ashesh Vashi
e27e39a8f3 Added support for the infrastructure for on demand access/create the
server connection.

The BaseDriver and BaseConnection are two abstract classes, which allows
us to replace the existing driver with the currently used. The current
implementation supports to connect the PostgreSQL and Postgres Plus
Advanced Server using the psycopg2 driver.
2015-10-20 12:33:29 +05:30
Ashesh Vashi
b52d72f176 Do flush the changes done after creating the require tables. Because -
it causes an issue performing DDL operations without sending DML to the
database, flush(..) does the job for us, it sends those operations to
the database without committing it.

And, this was causing the issue in current implemenation, while setting
'Administrator' role to the given email-id after the create_role, and
create_user operations during setup.
2015-09-22 11:19:50 +05:30
Ashesh Vashi
86479453b3 Check for current schema version on startup and update the schema (if
required).
2015-07-22 22:12:42 +05:30
Ashesh Vashi
aa150030eb Introduced a mechanism to load required javascripts at runtime
(lazy loading) using the require.js. This allows us to load the
javascript required for any node, only when it was loaded in the browser
tree. Also, introduced the mechanism to show/edit/create of any node in
a tab panel (wcDocker.Panel).
2015-06-30 11:21:57 +05:30
Ashesh Vashi
35d01bea3e Introduced a class - NodeView to achieve REST API required by the
PostgreSQL node(s).

Browser Tree Node (PostgreSQL object) requires more than just CRUD.
i.e.
   - CRUD (Create, Read, Update & Delete)
    - Reversed Engineered SQL for the object
    - Modified Query in edit mode
      i.e. ALTER TABLE ...
    - Statistics
    - List of dependents
    - List of dependencies
    - Children node list

This class can be inherited to achieve the different routes for each of
the object types/collections.

    OPERATION      |              URL       | Method
    ---------------+------------------------+--------
    List           | /obj/[Parent URL]/     | GET
    Properties     | /obj/[Parent URL]/id   | GET
    Create         | /obj/[Parent URL]/     | POST
    Delete         | /obj/[Parent URL]/id   | DELETE
    Update         | /obj/[Parent URL]/id   | PUT

    SQL (Reversed  | /sql/[Parent URL]/id   | GET
    Engineering)   |
    SQL (Modified  | /sql/[Parent URL]/id   | POST
    Properties)    |

    Statistics     | /stats/[Parent URL]/id | GET
    Dependencies   | /deps/[Parent URL]/id  | GET
    Dependents     | /deps/[Parent URL]/id  | POST

    Children Nodes | /nodes/[Parent URL]/id | GET

    NOTE:
    Parent URL can be seen as the path to identify the particular node.

    i.e.
     In order to identify the TABLE object, we requires information
     about the server -> database -> schema objects.

     Hence, the Parent URL for the TABLE object will be something like
     this as below:
     <int:sid>/<str:database>/<str:schema>

Inherited a new classes ServerGroupView and ServerView, which are
inherited from the NodeView for the implementation of above operations.
2015-06-29 13:41:56 +05:30
Dave Page
7f68d6fced Update the setup script and config database to handle versioning.
This allows us to update the configuration database schema as needed,
and use the setup script to update it to the current version.

NOTE: Existing databases will need to be recreated once following
this commit. It doesn't seem worth handling the "upgrade from v0"
case when I'm probably the only active developer right now.
2015-03-09 15:06:10 +00:00
Dave Page
613df8b596 Copyright year fixes and doc tweaks. 2015-02-25 20:25:41 +00:00
Dave Page
b09c1b6c68 Fix the gutter height of the editor when the parent is resized. 2015-02-13 13:13:36 +00:00
Dave Page
e995104000 Initial cut at saving/retrieving the main browser layout.
Still needs some work to:

- Minimise AJAX calls by writing multiple settings at once.
- Move the settings storage/retrieval JS code into a global file
- Avoid using synchronous AJAX calls in the main thread
2015-02-11 10:00:57 +00:00
Dave Page
afd5626fe4 Add a simple module for storing and retrieving settings from the
config database.
2015-02-03 11:48:15 +00:00
Dave Page
7c60fb3377 Support a desktop authentication mode.
This uses a single default user in the config database, which is
auto-logged into the app when SERVER_MODE = False. In this mode we
also hide/remove user-related functions in the UI.
2015-01-26 15:20:28 +00:00
Dave Page
10515431c7 Add authentication and the basis of the browser module.
A user authentication module based on flask-security is added, which
allows users to login and change/recover passwords etc. Custom templates
are included for the user/password UIs.

A new setup script will initialise the user (and later settings) DB,
adding the first user and granting them an Administrator role.

A redirects blueprint module is added to handle simple URL redirects.

A browser module is added and currently renders a skeleton page with
a menu bar, gravatar and jumbotron.

NOTE FOR LATER: Currently this code might make the nice basis for any
web app that needs user management and plugins. Hmmm....
2015-01-22 15:56:23 +00:00