Ignore:
Timestamp:
1 Oct 2019, 08:46:59 (5 years ago)
Author:
Henrik Bettermann
Message:

Take DELETION_MARKER into consideration when updating passwords.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/batching.py

    r14804 r15628  
    2727from zope.catalog.interfaces import ICatalog
    2828from waeup.kofa.interfaces import (
    29     IBatchProcessor, IObjectConverter, FatalCSVError, IGNORE_MARKER,
     29    IBatchProcessor, IObjectConverter, FatalCSVError,
     30    IGNORE_MARKER, DELETION_MARKER,
    3031    IObjectHistory, IUserAccount, DuplicationError)
    3132from waeup.kofa.interfaces import MessageFactory as _
     
    243244            row.pop('application_number')
    244245
    245         # Update password
     246        # Update
    246247        if 'password' in row:
    247248            passwd = row.get('password', IGNORE_MARKER)
     
    250251                    # already encrypted password
    251252                    obj.password = passwd
     253                elif passwd == DELETION_MARKER:
     254                    obj.password = None
    252255                else:
    253256                    # not yet encrypted password
  • main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py

    r15446 r15628  
    3737from waeup.kofa.interfaces import (
    3838    IBatchProcessor, FatalCSVError, IObjectConverter, IUserAccount,
    39     IObjectHistory, VALIDATED, REGISTERED, IGNORE_MARKER)
     39    IObjectHistory, VALIDATED, REGISTERED, IGNORE_MARKER, DELETION_MARKER)
    4040from waeup.kofa.interfaces import IKofaUtils, DuplicationError
    4141from waeup.kofa.interfaces import MessageFactory as _
     
    213213
    214214        # Update password
    215         # XXX: Take DELETION_MARKER into consideration
    216215        if 'password' in row:
    217216            passwd = row.get('password', IGNORE_MARKER)
     
    220219                    # already encrypted password
    221220                    obj.password = passwd
     221                elif passwd == DELETION_MARKER:
     222                    obj.password = None
    222223                else:
    223224                    # not yet encrypted password
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data.csv

    r13100 r15628  
    1 student_id,firstname,lastname,reg_number,date_of_birth,matric_number,email,phone,sex,state
    2 X666666,Aaren,Pieri,1,1990-01-02,100000,,1234,M,courses validated
    3 Y777777,Claus,Finau,2,1990-01-03,100001,aa@aa.ng,1234,m,courses validated
    4 ,Susann,Berson,3,1990-01-04,100002,aa@aa.ng,1234,F,courses validated
    5 ,Else,Mueller,4,1990-01-05,100003,aa@aa.ng,1234,f,school fee paid
    6 ,,,,,,,,,
    7 ,,,,  ,,, ,,
    8 ,,,,<IGNORE>,,,<IGNORE>,,
    9 X888888,Alfons,Meier,5,1990-01-02,100004,aa@aa.ng,1234,m,courses validated
    10 X999999,Herbert,Mueller,6,1990-01-02,100005,aa@aa.ng,1234,m,courses registered
    11 X111111,Fabian,Riester,7,1990-01-02,100006,aa@aa.ng,1234,m,courses validated
    12 X222222,Thomas,Kinderman,8,1990-01-02,100007,aa@aa.ng,1234,m,courses validated
    13 X333333,Paula,Schall,9,1990-01-02,100008,aa@aa.ng,1234,m,courses registered
     1student_id,firstname,lastname,reg_number,date_of_birth,matric_number,email,phone,sex,state,password
     2X666666,Aaren,Pieri,1,1990-01-02,100000,,1234,M,courses validated,test1234
     3Y777777,Claus,Finau,2,1990-01-03,100001,aa@aa.ng,1234,m,courses validated,
     4,Susann,Berson,3,1990-01-04,100002,aa@aa.ng,1234,F,courses validated,
     5,Else,Mueller,4,1990-01-05,100003,aa@aa.ng,1234,f,school fee paid,
     6,,,,,,,,,,
     7,,,,  ,,, ,,,
     8,,,,<IGNORE>,,,<IGNORE>,,,
     9X888888,Alfons,Meier,5,1990-01-02,100004,aa@aa.ng,1234,m,courses validated,
     10X999999,Herbert,Mueller,6,1990-01-02,100005,aa@aa.ng,1234,m,courses registered,
     11X111111,Fabian,Riester,7,1990-01-02,100006,aa@aa.ng,1234,m,courses validated,
     12X222222,Thomas,Kinderman,8,1990-01-02,100007,aa@aa.ng,1234,m,courses validated,
     13X333333,Paula,Schall,9,1990-01-02,100008,aa@aa.ng,1234,m,courses registered,
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data_update2.csv

    r8229 r15628  
    1 date_of_birth,matric_number,phone
    2 1970-01-02,100000,
    3 1970-01-03,100001,XXX
    4 1970-01-04,100002,<IGNORE>
     1date_of_birth,matric_number,phone,password
     21970-01-02,100000,,XXX
     31970-01-03,100001,XXX,
     41970-01-04,100002,<IGNORE>,
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py

    r15421 r15628  
    451451            self.csv_file, STUDENT_HEADER_FIELDS)
    452452        shutil.rmtree(os.path.dirname(fin_file))
     453        container = self.app['students']
     454        self.assertEqual(
     455            IUserAccount(container['X666666']).checkPassword('test1234'), True)
    453456        num, num_warns, fin_file, fail_file = self.processor.doImport(
    454457            self.csv_file_update2, STUDENT_HEADER_FIELDS_UPDATE2, 'update')
     
    456459        # The phone import value of Pieri was None.
    457460        # Confirm that phone has not been cleared.
    458         container = self.app['students']
    459461        for key in container.keys():
    460462            if container[key].firstname == 'Aaren':
     
    469471                break
    470472        assert claus.phone is None
     473        # The password of X666666 has been removed
     474        self.assertEqual(
     475            IUserAccount(container['X666666']).password, None)
    471476        shutil.rmtree(os.path.dirname(fin_file))
    472477
Note: See TracChangeset for help on using the changeset viewer.