public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nikhil Mohite <[email protected]>
To: Akshay Joshi <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Cc: Dave Page <[email protected]>
Subject: Re: [pgAdmin][RM-6120]: Adding/updating user should not allow to add an older date in account expires.
Date: Thu, 14 Jan 2021 17:58:00 +0530
Message-ID: <CAOBg0AMPK7rCfXLykF+1JX_+DVq31TON+G01bpzs69aPTs7QEg@mail.gmail.com> (raw)
In-Reply-To: <CANxoLDeHgFxMRBAg++3mLkGmFjDwJPKqBNz3wkhK99+rq86N8g@mail.gmail.com>
References: <CAOBg0AMsjjfovd9tpdikhwrqYMq_v51jNyqPQFc1WofxjaDU_Q@mail.gmail.com>
	<CANxoLDdMuF+p9kHnioFgjzDwrvR+aKTzpa7EZEDSZVszrTBJ7g@mail.gmail.com>
	<CA+OCxoyghzW2OJyxC2MpyHX3=T=pSJm1s5nxG8qZO_e6Hm08SA@mail.gmail.com>
	<CANxoLDeHgFxMRBAg++3mLkGmFjDwJPKqBNz3wkhK99+rq86N8g@mail.gmail.com>

Hi Akshay,

Please find the updated patch, updated UI to allow users to select an older
date for the account expires.


Regards,
Nikhil Mohite.

On Thu, Jan 14, 2021 at 2:52 PM Akshay Joshi <[email protected]>
wrote:

> Hi Nikhil
>
> On Thu, Jan 14, 2021 at 2:38 PM Dave Page <[email protected]> wrote:
>
>>
>>
>> On Thu, Jan 14, 2021 at 8:18 AM Akshay Joshi <
>> [email protected]> wrote:
>>
>>> Thanks, patch applied.
>>>
>>> On Thu, Jan 14, 2021 at 11:28 AM Nikhil Mohite <
>>> [email protected]> wrote:
>>>
>>>> Hi Team,
>>>>
>>>> Please find the attached patch for RM-6120
>>>> <https://redmine.postgresql.org/issues/6120;: Adding/updating user
>>>> should not allow to add an older date in account expires.
>>>> Added UI validation if a user enters the account expiration date
>>>> manually.
>>>>
>>>
>> I think this needs to be reverted (and the UI fixed to allow an older
>> date to be selected).
>>
>
>    Please fixed as suggested by Dave and send the patch. I'll update the
> RM
>
>>
>> Selecting a past expiry date is a perfectly valid way to create an
>> account that is effectively locked, for example, to allow pre-creation of
>> roles for staff that are yet to join.
>>
>> PostgreSQL doesn't prevent this - why should we?
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EDB: http://www.enterprisedb.com
>>
>>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
> *pgAdmin Hacker | Principal Software Architect*
> *EDB Postgres <http://edbpostgres.com>*
>
> *Mobile: +91 976-788-8246*
>


Attachments:

  [application/octet-stream] RM_6120_v2.patch (2.0K, 3-RM_6120_v2.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/roles/static/js/role.js b/web/pgadmin/browser/server_groups/servers/roles/static/js/role.js
index 68909fd8..6c382854 100644
--- a/web/pgadmin/browser/server_groups/servers/roles/static/js/role.js
+++ b/web/pgadmin/browser/server_groups/servers/roles/static/js/role.js
@@ -416,6 +416,7 @@ define('pgadmin.node.role', [
           deps: ['rolcanlogin'],
           placeholder: gettext('No Expiry'),
           helpMessage: gettext('Please note that if you leave this field blank, then password will never expire.'),
+          setMinDate: false,
         },{
           id: 'rolconnlimit',  type: 'int', group: gettext('Definition'),
           label: gettext('Connection limit'), cell: 'integer', min : -1,
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index 24295c74..3686ffe5 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -2820,6 +2820,7 @@ define([
         placeholder: 'YYYY-MM-DD HH:mm:ss Z',
         extraClasses: [],
         helpMessage: null,
+        setMinDate: true,
       },
       events: {
         'blur input': 'onChange',
@@ -3008,6 +3009,18 @@ define([
             data.value = null;
           }
 
+          var dateSettings = {};
+          if (!data.setMinDate) {
+            dateSettings = {
+              'date': data.value,
+            };
+          } else {
+            dateSettings = {
+              'date': data.value,
+              'minDate': data.value,
+            };
+          }
+
           this.$el.find('input').first().datetimepicker(
             _.extend({
               keyBinds: {
@@ -3044,10 +3057,7 @@ define([
                   }
                 },
               },
-            }, this.defaults.options, this.field.get('options'), {
-              'date': data.value,
-              'minDate': data.value,
-            })
+            }, this.defaults.options, this.field.get('options'), dateSettings)
           );
         }
         this.updateInvalid();


view thread (6+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: [pgAdmin][RM-6120]: Adding/updating user should not allow to add an older date in account expires.
  In-Reply-To: <CAOBg0AMPK7rCfXLykF+1JX_+DVq31TON+G01bpzs69aPTs7QEg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox