Changeset 16579


Ignore:
Timestamp:
Aug 31, 2016, 5:40:36 PM (3 years ago)
Author:
dcorreia
Message:

Updated tests data file.
Fixed bugs and design based on test results.

Location:
internals/2016/linuxloginsmartcardwizard
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • internals/2016/linuxloginsmartcardwizard/.idea/workspace.xml

    r16567 r16579  
    33  <component name="ChangeListManager">
    44    <list default="true" readonly="true" id="fbd8e757-714d-41c6-a2b9-8558c09dbd04" name="Default" comment="">
    5       <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/trunk/proto1/settingswin.py" />
     5      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/docs/testsdata.ods" afterPath="$PROJECT_DIR$/docs/testsdata.ods" />
    66      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
     7      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/trunk/proto1/carduser.py" afterPath="$PROJECT_DIR$/trunk/proto1/carduser.py" />
    78      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/trunk/proto1/config.py" afterPath="$PROJECT_DIR$/trunk/proto1/config.py" />
     9      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/trunk/proto1/main.py" afterPath="$PROJECT_DIR$/trunk/proto1/main.py" />
    810      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/trunk/proto1/mainwin.py" afterPath="$PROJECT_DIR$/trunk/proto1/mainwin.py" />
     11      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/trunk/proto1/settingswin.py" afterPath="$PROJECT_DIR$/trunk/proto1/settingswin.py" />
     12      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/trunk/proto1/w4pages.py" afterPath="$PROJECT_DIR$/trunk/proto1/w4pages.py" />
    913    </list>
    1014    <ignored path="estagiopycharm.iws" />
     
    2933        <entry file="file://$PROJECT_DIR$/trunk/proto1/mainwin.py">
    3034          <provider selected="true" editor-type-id="text-editor">
    31             <state relative-caret-position="504">
    32               <caret line="82" column="0" selection-start-line="82" selection-start-column="0" selection-end-line="82" selection-end-column="0" />
     35            <state relative-caret-position="422">
     36              <caret line="95" column="32" selection-start-line="95" selection-start-column="32" selection-end-line="95" selection-end-column="32" />
    3337              <folding>
    3438                <element signature="e#19#61#0" expanded="true" />
     
    3842        </entry>
    3943      </file>
    40       <file leaf-file-name="settingswin.py" pinned="false" current-in-tab="false">
     44      <file leaf-file-name="w4pages.py" pinned="false" current-in-tab="false">
     45        <entry file="file://$PROJECT_DIR$/trunk/proto1/w4pages.py">
     46          <provider selected="true" editor-type-id="text-editor">
     47            <state relative-caret-position="257">
     48              <caret line="28" column="45" selection-start-line="28" selection-start-column="45" selection-end-line="28" selection-end-column="45" />
     49              <folding>
     50                <element signature="e#0#42#0" expanded="true" />
     51              </folding>
     52            </state>
     53          </provider>
     54        </entry>
     55      </file>
     56      <file leaf-file-name="settingswin.py" pinned="false" current-in-tab="true">
    4157        <entry file="file://$PROJECT_DIR$/trunk/proto1/settingswin.py">
    4258          <provider selected="true" editor-type-id="text-editor">
    43             <state relative-caret-position="108">
    44               <caret line="6" column="14" selection-start-line="6" selection-start-column="6" selection-end-line="6" selection-end-column="28" />
     59            <state relative-caret-position="187">
     60              <caret line="46" column="74" selection-start-line="46" selection-start-column="74" selection-end-line="46" selection-end-column="74" />
    4561              <folding>
    4662                <element signature="e#19#54#0" expanded="true" />
     
    5369        <entry file="file://$PROJECT_DIR$/trunk/proto1/checksystem.py">
    5470          <provider selected="true" editor-type-id="text-editor">
    55             <state relative-caret-position="1278">
     71            <state relative-caret-position="581">
    5672              <caret line="72" column="56" selection-start-line="72" selection-start-column="56" selection-end-line="72" selection-end-column="56" />
    5773              <folding>
     
    6581        <entry file="file://$PROJECT_DIR$/trunk/proto1/carduser.py">
    6682          <provider selected="true" editor-type-id="text-editor">
    67             <state relative-caret-position="2448">
    68               <caret line="138" column="35" selection-start-line="138" selection-start-column="35" selection-end-line="138" selection-end-column="35" />
     83            <state relative-caret-position="-373">
     84              <caret line="33" column="55" selection-start-line="33" selection-start-column="55" selection-end-line="33" selection-end-column="55" />
    6985              <folding />
    7086            </state>
     
    7591        <entry file="file://$PROJECT_DIR$/trunk/proto1/main.py">
    7692          <provider selected="true" editor-type-id="text-editor">
    77             <state relative-caret-position="1026">
    78               <caret line="57" column="34" selection-start-line="57" selection-start-column="34" selection-end-line="57" selection-end-column="34" />
    79               <folding />
     93            <state relative-caret-position="167">
     94              <caret line="55" column="52" selection-start-line="55" selection-start-column="52" selection-end-line="55" selection-end-column="52" />
     95              <folding>
     96                <marker date="1472656592640" expanded="true" signature="1491:1548" ph="..." />
     97              </folding>
    8098            </state>
    8199          </provider>
     
    94112        </entry>
    95113      </file>
    96       <file leaf-file-name="config.py" pinned="false" current-in-tab="true">
     114      <file leaf-file-name="config.py" pinned="false" current-in-tab="false">
    97115        <entry file="file://$PROJECT_DIR$/trunk/proto1/config.py">
    98116          <provider selected="true" editor-type-id="text-editor">
    99             <state relative-caret-position="-489">
    100               <caret line="430" column="43" selection-start-line="430" selection-start-column="43" selection-end-line="430" selection-end-column="43" />
     117            <state relative-caret-position="124">
     118              <caret line="403" column="30" selection-start-line="403" selection-start-column="11" selection-end-line="403" selection-end-column="30" />
    101119              <folding>
    102120                <element signature="e#19#29#0" expanded="true" />
     
    127145                <element signature="e#10894#10967#1" expanded="true" />
    128146                <element signature="e#11184#11257#1" expanded="true" />
    129                 <element signature="e#11495#11670#1" expanded="true" />
    130                 <element signature="e#11762#11926#1" expanded="true" />
    131                 <element signature="e#12122#12215#1" expanded="true" />
    132                 <element signature="e#12638#12816#1" expanded="true" />
     147                <element signature="e#11668#11843#1" expanded="true" />
     148                <element signature="e#11940#12104#1" expanded="true" />
     149                <element signature="e#12262#12355#1" expanded="true" />
     150                <element signature="e#12778#12956#1" expanded="true" />
    133151              </folding>
    134152            </state>
     
    182200        <option value="$PROJECT_DIR$/trunk/proto1/eidlibPython_Wrapper/examples/simple_example.py" />
    183201        <option value="$PROJECT_DIR$/trunk/proto1/cardHelper.py" />
    184         <option value="$PROJECT_DIR$/trunk/proto1/carduser.py" />
    185202        <option value="$PROJECT_DIR$/trunk/proto1/final.py" />
    186203        <option value="$PROJECT_DIR$/trunk/proto1/welcome.py" />
    187204        <option value="$PROJECT_DIR$/trunk/proto1/fileHelper.py" />
     205        <option value="$PROJECT_DIR$/trunk/proto1/checksystem.py" />
     206        <option value="$PROJECT_DIR$/trunk/proto1/main.py" />
    188207        <option value="$PROJECT_DIR$/trunk/proto1/w4pages.py" />
    189         <option value="$PROJECT_DIR$/trunk/proto1/main.py" />
    190         <option value="$PROJECT_DIR$/trunk/proto1/checksystem.py" />
     208        <option value="$PROJECT_DIR$/trunk/proto1/carduser.py" />
     209        <option value="$PROJECT_DIR$/trunk/proto1/config.py" />
    191210        <option value="$PROJECT_DIR$/trunk/proto1/mainwin.py" />
    192211        <option value="$PROJECT_DIR$/trunk/proto1/settingswin.py" />
    193         <option value="$PROJECT_DIR$/trunk/proto1/config.py" />
    194212      </list>
    195213    </option>
     
    800818      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.23647605" sideWeight="0.49323785" order="12" side_tool="false" content_ui="tabs" />
    801819      <window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32612056" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
    802       <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.28748068" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
    803820      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24900557" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
    804821      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.23029366" sideWeight="0.4953125" order="10" side_tool="false" content_ui="tabs" />
    805822      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.17263326" sideWeight="0.508046" order="1" side_tool="true" content_ui="tabs" />
    806       <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39876354" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
    807823      <window_info id="SVN Repositories" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32921174" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
    808824      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
     
    811827      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
    812828      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
     829      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.28748068" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
    813830      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
    814831      <window_info id="Inspection Results" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32945737" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
    815832      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
     833      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39876354" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
    816834    </layout>
    817835  </component>
     
    861879  <component name="XDebuggerManager">
    862880    <breakpoint-manager>
    863       <option name="time" value="31" />
     881      <option name="time" value="32" />
    864882    </breakpoint-manager>
    865883    <watches-manager />
     
    10231041    </entry>
    10241042    <entry file="file://$PROJECT_DIR$/trunk/proto1/system.py" />
    1025     <entry file="file://$PROJECT_DIR$/trunk/proto1/eidlibPython_Wrapper/GeneratedModule/pteid.py">
    1026       <provider selected="true" editor-type-id="text-editor">
    1027         <state relative-caret-position="360">
    1028           <caret line="667" column="24" selection-start-line="667" selection-start-column="24" selection-end-line="667" selection-end-column="24" />
    1029         </state>
    1030       </provider>
    1031     </entry>
     1043    <entry file="file://$PROJECT_DIR$/trunk/proto1/eidlibPython_Wrapper/GeneratedModule/pteid.py" />
    10321044    <entry file="file://$PROJECT_DIR$/trunk/proto1/cardHelper.py">
    10331045      <provider selected="true" editor-type-id="text-editor">
     
    10371049      </provider>
    10381050    </entry>
    1039     <entry file="file://$PROJECT_DIR$/trunk/proto1/eidlibPython_Wrapper/examples/simple_example.py">
    1040       <provider selected="true" editor-type-id="text-editor">
    1041         <state relative-caret-position="1098">
    1042           <caret line="61" column="0" selection-start-line="61" selection-start-column="0" selection-end-line="61" selection-end-column="0" />
    1043         </state>
    1044       </provider>
    1045     </entry>
     1051    <entry file="file://$PROJECT_DIR$/trunk/proto1/eidlibPython_Wrapper/examples/simple_example.py" />
    10461052    <entry file="file://$PROJECT_DIR$/trunk/proto1/final.py">
    10471053      <provider selected="true" editor-type-id="text-editor">
     
    10681074      </provider>
    10691075    </entry>
    1070     <entry file="file://$PROJECT_DIR$/trunk/proto1/carduser.py">
    1071       <provider selected="true" editor-type-id="text-editor">
    1072         <state relative-caret-position="2448">
    1073           <caret line="138" column="35" selection-start-line="138" selection-start-column="35" selection-end-line="138" selection-end-column="35" />
    1074           <folding />
    1075         </state>
    1076       </provider>
    1077     </entry>
    1078     <entry file="file://$PROJECT_DIR$/trunk/proto1/main.py">
    1079       <provider selected="true" editor-type-id="text-editor">
    1080         <state relative-caret-position="1026">
    1081           <caret line="57" column="34" selection-start-line="57" selection-start-column="34" selection-end-line="57" selection-end-column="34" />
    1082           <folding />
    1083         </state>
    1084       </provider>
    1085     </entry>
    1086     <entry file="file://$PROJECT_DIR$/trunk/proto1/checksystem.py">
    1087       <provider selected="true" editor-type-id="text-editor">
    1088         <state relative-caret-position="1278">
    1089           <caret line="72" column="56" selection-start-line="72" selection-start-column="56" selection-end-line="72" selection-end-column="56" />
    1090           <folding>
    1091             <element signature="e#0#42#0" expanded="true" />
    1092           </folding>
    1093         </state>
    1094       </provider>
    1095     </entry>
    1096     <entry file="file://$PROJECT_DIR$/trunk/proto1/w4pages.py">
    1097       <provider selected="true" editor-type-id="text-editor">
    1098         <state relative-caret-position="1098">
    1099           <caret line="63" column="13" selection-start-line="63" selection-start-column="13" selection-end-line="63" selection-end-column="13" />
    1100           <folding />
    1101         </state>
    1102       </provider>
    1103     </entry>
    11041076    <entry file="file://$PROJECT_DIR$/trunk/proto1/img/business-cards-database.png">
    11051077      <provider selected="true" editor-type-id="images">
     
    11071079      </provider>
    11081080    </entry>
    1109     <entry file="file://$PROJECT_DIR$/trunk/proto1/settingswin.py">
    1110       <provider selected="true" editor-type-id="text-editor">
    1111         <state relative-caret-position="108">
    1112           <caret line="6" column="14" selection-start-line="6" selection-start-column="6" selection-end-line="6" selection-end-column="28" />
     1081    <entry file="file://$PROJECT_DIR$/trunk/proto1/main.py">
     1082      <provider selected="true" editor-type-id="text-editor">
     1083        <state relative-caret-position="167">
     1084          <caret line="55" column="52" selection-start-line="55" selection-start-column="52" selection-end-line="55" selection-end-column="52" />
    11131085          <folding>
    1114             <element signature="e#19#54#0" expanded="true" />
     1086            <marker date="1472656592640" expanded="true" signature="1491:1548" ph="..." />
    11151087          </folding>
    11161088        </state>
    11171089      </provider>
    11181090    </entry>
    1119     <entry file="file://$PROJECT_DIR$/trunk/proto1/mainwin.py">
    1120       <provider selected="true" editor-type-id="text-editor">
    1121         <state relative-caret-position="504">
    1122           <caret line="82" column="0" selection-start-line="82" selection-start-column="0" selection-end-line="82" selection-end-column="0" />
    1123           <folding>
    1124             <element signature="e#19#61#0" expanded="true" />
    1125           </folding>
     1091    <entry file="file://$PROJECT_DIR$/trunk/proto1/carduser.py">
     1092      <provider selected="true" editor-type-id="text-editor">
     1093        <state relative-caret-position="-373">
     1094          <caret line="33" column="55" selection-start-line="33" selection-start-column="55" selection-end-line="33" selection-end-column="55" />
     1095          <folding />
    11261096        </state>
    11271097      </provider>
     
    11291099    <entry file="file://$PROJECT_DIR$/trunk/proto1/config.py">
    11301100      <provider selected="true" editor-type-id="text-editor">
    1131         <state relative-caret-position="-489">
    1132           <caret line="430" column="43" selection-start-line="430" selection-start-column="43" selection-end-line="430" selection-end-column="43" />
     1101        <state relative-caret-position="124">
     1102          <caret line="403" column="30" selection-start-line="403" selection-start-column="11" selection-end-line="403" selection-end-column="30" />
    11331103          <folding>
    11341104            <element signature="e#19#29#0" expanded="true" />
     
    11591129            <element signature="e#10894#10967#1" expanded="true" />
    11601130            <element signature="e#11184#11257#1" expanded="true" />
    1161             <element signature="e#11495#11670#1" expanded="true" />
    1162             <element signature="e#11762#11926#1" expanded="true" />
    1163             <element signature="e#12122#12215#1" expanded="true" />
    1164             <element signature="e#12638#12816#1" expanded="true" />
     1131            <element signature="e#11668#11843#1" expanded="true" />
     1132            <element signature="e#11940#12104#1" expanded="true" />
     1133            <element signature="e#12262#12355#1" expanded="true" />
     1134            <element signature="e#12778#12956#1" expanded="true" />
    11651135          </folding>
    11661136        </state>
    11671137      </provider>
    11681138    </entry>
     1139    <entry file="file://$PROJECT_DIR$/trunk/proto1/mainwin.py">
     1140      <provider selected="true" editor-type-id="text-editor">
     1141        <state relative-caret-position="422">
     1142          <caret line="95" column="32" selection-start-line="95" selection-start-column="32" selection-end-line="95" selection-end-column="32" />
     1143          <folding>
     1144            <element signature="e#19#61#0" expanded="true" />
     1145          </folding>
     1146        </state>
     1147      </provider>
     1148    </entry>
     1149    <entry file="file://$PROJECT_DIR$/trunk/proto1/w4pages.py">
     1150      <provider selected="true" editor-type-id="text-editor">
     1151        <state relative-caret-position="257">
     1152          <caret line="28" column="45" selection-start-line="28" selection-start-column="45" selection-end-line="28" selection-end-column="45" />
     1153          <folding>
     1154            <element signature="e#0#42#0" expanded="true" />
     1155          </folding>
     1156        </state>
     1157      </provider>
     1158    </entry>
     1159    <entry file="file://$PROJECT_DIR$/trunk/proto1/checksystem.py">
     1160      <provider selected="true" editor-type-id="text-editor">
     1161        <state relative-caret-position="581">
     1162          <caret line="72" column="56" selection-start-line="72" selection-start-column="56" selection-end-line="72" selection-end-column="56" />
     1163          <folding>
     1164            <element signature="e#0#42#0" expanded="true" />
     1165          </folding>
     1166        </state>
     1167      </provider>
     1168    </entry>
     1169    <entry file="file://$PROJECT_DIR$/trunk/proto1/settingswin.py">
     1170      <provider selected="true" editor-type-id="text-editor">
     1171        <state relative-caret-position="187">
     1172          <caret line="46" column="74" selection-start-line="46" selection-start-column="74" selection-end-line="46" selection-end-column="74" />
     1173          <folding>
     1174            <element signature="e#19#54#0" expanded="true" />
     1175          </folding>
     1176        </state>
     1177      </provider>
     1178    </entry>
    11691179  </component>
    11701180</project>
  • internals/2016/linuxloginsmartcardwizard/trunk/proto1/carduser.py

    r16540 r16579  
    2626        self.goodCardLabel = QtWidgets.QLabel(self)
    2727        self.goodCardLabel.setEnabled(True)
    28         self.goodCardLabel.setGeometry(QtCore.QRect(315, 95, 45, 45))
     28        self.goodCardLabel.setGeometry(QtCore.QRect(335, 95, 45, 45))
    2929        self.goodCardLabel.setPixmap(QtGui.QPixmap("img/green-checkmark.png"))
    3030        self.goodCardLabel.setScaledContents(True)
     
    3232
    3333        self.readCardButton = QtWidgets.QPushButton(self)
    34         self.readCardButton.setGeometry(QtCore.QRect(280, 35, 150, 30))
     34        self.readCardButton.setGeometry(QtCore.QRect(305, 35, 150, 30))
    3535        self.readCardButton.setText("Read smartcard again")
    3636        self.readCardButton.hide()
     
    6060        self.goodUserLabel = QtWidgets.QLabel(self)
    6161        self.goodUserLabel.setEnabled(True)
    62         self.goodUserLabel.setGeometry(QtCore.QRect(315, 195, 45, 45))
     62        self.goodUserLabel.setGeometry(QtCore.QRect(335, 195, 45, 45))
    6363        self.goodUserLabel.setPixmap(QtGui.QPixmap("img/green-checkmark.png"))
    6464        self.goodUserLabel.setScaledContents(True)
     
    155155                main.configureUserMapping(self.getCurrentBoxOption(), self.cardSubjectInfo)
    156156                return True
     157            return False
    157158        else:
    158159            self.messageBox.critical(self, "Title", "The chosen configuration already exists.\n\n" +
  • internals/2016/linuxloginsmartcardwizard/trunk/proto1/config.py

    r16567 r16579  
    355355
    356356
    357 def hasAdminPermissions(currentUser):
     357def getCurrentUser():
     358    try:
     359        return os.getlogin()
     360    except FileNotFoundError:
     361        # use directory trick to find current user
     362        return os.getcwd().split("/")[2]
     363
     364
     365def hasAdminPermissions():
    358366    """
    359367    Checks if current user has administrator permissions
     
    361369    :return: True if user has permissions and False otherwise
    362370    """
    363     return currentUser in grp.getgrnam("adm").gr_mem
     371    return getCurrentUser() in grp.getgrnam("adm").gr_mem
    364372
    365373
     
    370378    :return: the filtered list
    371379    """
    372     currentUser = os.getlogin()
    373     if not hasAdminPermissions(currentUser):
    374         userList = [user for user in userList if user == currentUser]
     380    if not hasAdminPermissions():
     381        userList = [user for user in userList if user == getCurrentUser()]
    375382    return userList
    376383
     
    395402    :return: the filtered list
    396403    """
    397     currentUser = os.getlogin()
    398     if not hasAdminPermissions(currentUser):
    399         combosList = [combo for combo in combosList if currentUser in combo]
     404    if not hasAdminPermissions():
     405        combosList = [combo for combo in combosList if getCurrentUser() in combo]
    400406    return combosList
    401407
  • internals/2016/linuxloginsmartcardwizard/trunk/proto1/main.py

    r16560 r16579  
    5555        username = input("Please write the username to be used in the mapping\n")
    5656    if config.addUserMapping(username, certificate):
    57         # Simulate pam-auth-update manually to change content of common-auth
    58         config.enablePkcs11Login()
    5957        config.deleteTemporaryData()
    6058        return True
  • internals/2016/linuxloginsmartcardwizard/trunk/proto1/mainwin.py

    r16566 r16579  
    44import os
    55import config
    6 import subprocess
    76import settingswin
     7import w4pages
    88
    99
     
    5959        self.statusbarLabel = QtWidgets.QLabel(self.statusbar)
    6060
    61         self.statusbarLabel.setStyleSheet("margin-left: 290px")
     61        self.statusbarLabel.setStyleSheet("margin-left: 250px")
    6262        self.statusbar.addWidget(self.statusbarLabel, 10)
    6363
     
    8686        self.statusbarSlider.valueChanged.connect(self.changeLoginStatus)
    8787
    88         self.wizardProcess = None
     88        self.wizardWindow = None
    8989        self.customizeWindow = None
    9090
     
    9595
    9696    def openAddUserWizard(self):
    97         if self.isWizardProcessActive():
     97        if self.isWizardActive():
    9898            self.messageBox.critical(self, "Title", "\nYou already have an add user login wizard open.\n\n"
    9999                                                    "Please finish or close the current wizard before\n"
    100100                                                    "trying to open a new add user login wizard.\n")
    101101        else:
    102             self.wizardProcess = subprocess.Popen(["sudo", "python3", "w4pages.py"])
     102            self.wizardWindow = w4pages.MyWizard()
     103            self.wizardWindow.open()
    103104
    104105    def resetLoginConfigs(self):
    105         if self.isWizardProcessActive():
    106             self.messageBox.critical(self, "Title", "\nPlease close the current add user login wizard\n"
    107                                                     "before trying to reset the login configurations.\n\n")
    108106        if config.listLocalCombos() is None or config.listLocalCombos() == []:
    109107            message = "\nYou have no local configurations yet.\n\n" \
     
    115113            self.customizeWindow.show()
    116114
    117     def isWizardProcessActive(self):
    118         if self.wizardProcess is None:
    119             return False
    120         elif self.wizardProcess.poll() is not None:
    121             return False
    122         else:
    123             return True
    124 
    125115    def checkLoginStatus(self):
    126         if config.isPkcs11Installed() and config.hasAdminPermissions(os.getlogin()):
     116        if config.isPkcs11Installed() and config.hasAdminPermissions():
    127117            self.statusbarSlider.show()
    128118            if config.isPkcs11LoginEnabled():
     
    142132        self.checkLoginStatus()
    143133
     134    def isWizardActive(self):
     135        if self.wizardWindow is None:
     136            return False
     137        else:
     138            return self.wizardWindow.isVisible()
     139
    144140    def closeEvent(self, QCloseEvent):
    145141        if self.customizeWindow is not None:
    146142            self.customizeWindow.close()
    147         if self.isWizardProcessActive():
     143        if self.isWizardActive():
    148144            reply = self.messageBox.warning(self, "Title",  "\nYou have an add user login wizard open.\n\n"
    149145                                                            "Closing this window will also close the wizard \n"
     
    152148                                                            QMessageBox.No, QMessageBox.Yes)
    153149            if reply == QMessageBox.Yes:
    154                 self.wizardProcess.kill()
     150                self.wizardWindow.done(0)
    155151                QCloseEvent.accept()
    156152            else:
     
    160156            QCloseEvent.accept()
    161157
    162     def enterEvent(self, QEvent):
    163         self.checkLoginStatus()
    164 
    165 
    166158if __name__ == "__main__":
    167159    import sys
     
    169161        print("Script not started as root. Running sudo...")
    170162        args = ["sudo", sys.executable] + sys.argv + [os.environ]
     163        print(*args)
    171164        os.execlpe("gksudo", *args)
     165    print("Running as sudo")
    172166    app = QtWidgets.QApplication(sys.argv)
    173167    ui = MyMainWindow()
  • internals/2016/linuxloginsmartcardwizard/trunk/proto1/settingswin.py

    r16566 r16579  
    88    def __init__(self):
    99        super(customizeConfigsWindow, self).__init__()
    10         self.resize(500, 400)
     10        # self.resize(500, 400)
     11        self.setFixedSize(500, 400)
    1112        self.centerOnScreen()
    1213
     
    146147                                        "you would like to delete.\n\n")
    147148        else:
    148             reply = self.messageBox.warning(self, "Title",
    149                                             "\nYou are about to delete the following login configurations:\n" +
    150                                             message + "\nAre you sure you want to delete them?\n",
    151                                             QMessageBox.No, QMessageBox.Yes)
     149            reply = self.messageBox.critical(self, "Title",
     150                                             "\nYou are about to delete the following login configurations:\n" +
     151                                             message + "\nAre you sure you want to delete them?\n",
     152                                             QMessageBox.No, QMessageBox.Yes)
    152153            if reply == QMessageBox.Yes:
    153154                if self.isDisabledComboList():
  • internals/2016/linuxloginsmartcardwizard/trunk/proto1/w4pages.py

    r16545 r16579  
    11from PyQt5 import QtCore, QtGui, QtWidgets
    22from PyQt5.QtWidgets import QMessageBox
    3 import welcome, checksystem, carduser, final
     3import welcome
     4import checksystem
     5import carduser
     6import final
    47
    58
     
    811        super(MyWizard, self).__init__()
    912        self.setObjectName("Wizard")
    10         self.resize(600, 450)
     13        # self.resize(600, 450)
     14        self.setFixedSize(600, 450)
     15        self.centerOnScreen()
     16
    1117        self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
    1218        self.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
     
    1420        self.setSizeGripEnabled(False)
    1521        self.setModal(True)
     22
    1623        self.customFont = QtGui.QFont()
    1724        self.customFont.setPointSize(10.5)
    1825        self.setFont(self.customFont)
    1926        self.setWizardStyle(QtWidgets.QWizard.ModernStyle)
     27
    2028        self.setOptions(QtWidgets.QWizard.HaveHelpButton |
    2129                        QtWidgets.QWizard.NoBackButtonOnLastPage |
     
    4048        self.messageBox = QtWidgets.QMessageBox()
    4149        self.helpRequested.connect(self.showHelp)
     50
     51    def centerOnScreen(self):
     52        resolution = QtWidgets.QDesktopWidget().screenGeometry()
     53        self.move((resolution.width() / 2) - (self.frameSize().width() / 2),
     54                  (resolution.height() / 2) - (self.frameSize().height() / 2))
    4255
    4356    def showHelp(self):
Note: See TracChangeset for help on using the changeset viewer.