Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
irods-clients
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RDM Infrastructure
irods-clients
Commits
c2af109d
Commit
c2af109d
authored
3 years ago
by
Staiger, Christine
Browse files
Options
Downloads
Patches
Plain Diff
Saving existing iRODS environment file and .irodsA file when logging in as anonymous user.
Moving saved configs back on Exit or Close
parent
611051df
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gui/mainmenu.py
+7
-4
7 additions, 4 deletions
gui/mainmenu.py
utils/irodsConnectorAnonymous.py
+32
-1
32 additions, 1 deletion
utils/irodsConnectorAnonymous.py
with
39 additions
and
5 deletions
gui/mainmenu.py
+
7
−
4
View file @
c2af109d
...
...
@@ -84,7 +84,10 @@ class mainmenu(QMainWindow):
quit_msg
=
"
Are you sure you want to exit the program?
"
reply
=
QMessageBox
.
question
(
self
,
'
Message
'
,
quit_msg
,
QMessageBox
.
Yes
,
QMessageBox
.
No
)
if
reply
==
QMessageBox
.
Yes
:
self
.
ic
.
session
.
cleanup
()
if
self
.
ic
:
self
.
ic
.
session
.
cleanup
()
elif
self
.
ticketAccessTab
.
ic
:
self
.
ticketAccessTab
.
ic
.
closeSession
()
sys
.
exit
()
else
:
pass
...
...
@@ -94,10 +97,10 @@ class mainmenu(QMainWindow):
quit_msg
=
"
Are you sure you want to disconnect?
"
reply
=
QMessageBox
.
question
(
self
,
'
Message
'
,
quit_msg
,
QMessageBox
.
Yes
,
QMessageBox
.
No
)
if
reply
==
QMessageBox
.
Yes
:
try
:
if
self
.
ic
:
self
.
ic
.
session
.
cleanup
()
e
xcept
:
pass
e
lif
self
.
ticketAccessTab
.
ic
:
self
.
ticketAccessTab
.
ic
.
closeSession
()
currentWidget
=
self
.
widget
.
currentWidget
()
self
.
widget
.
setCurrentIndex
(
self
.
widget
.
currentIndex
()
-
1
)
self
.
widget
.
removeWidget
(
currentWidget
)
...
...
This diff is collapsed.
Click to expand it.
utils/irodsConnectorAnonymous.py
+
32
−
1
View file @
c2af109d
...
...
@@ -3,8 +3,10 @@ from irods.ticket import Ticket
from
irods.exception
import
CollectionDoesNotExist
,
CAT_SQL_ERR
import
irods.keywords
as
kw
import
irods
import
uuid
from
utils.irodsConnector
import
irodsConnector
from
utils.utils
import
ensure_dir
import
os
from
base64
import
b64decode
...
...
@@ -35,6 +37,10 @@ class irodsConnectorAnonymous(irodsConnector):
path
=
path
[:
-
1
]
if
not
path
.
startswith
(
"
/
"
):
raise
Exception
(
"
Not a valid iRODS path.
"
)
self
.
tempEnv
=
None
self
.
tempIrodsA
=
None
zone
=
path
.
split
(
'
/
'
)[
1
]
self
.
session
=
iRODSSession
(
user
=
'
anonymous
'
,
password
=
''
,
...
...
@@ -46,7 +52,9 @@ class irodsConnectorAnonymous(irodsConnector):
self
.
icommands
=
False
self
.
icommands
=
subprocess
.
call
([
"
which
"
,
"
iinit
"
])
==
0
if
self
.
icommands
:
#do iinit
ensure_dir
(
os
.
path
.
expanduser
(
'
~
'
+
os
.
sep
+
'
.irods
'
))
#move previous iRODS sessions to tmp file (envFile and .irodsA file)
self
.
__movePrevSessionConfigs
(
False
)
env
=
{
"
irods_host
"
:
self
.
session
.
host
,
"
irods_port
"
:
1247
,
"
irods_user_name
"
:
"
anonymous
"
,
...
...
@@ -59,6 +67,29 @@ class irodsConnectorAnonymous(irodsConnector):
logging
.
info
(
'
AUTHENTICATION ERROR: Anonymous login failed.
'
)
self
.
icommands
=
False
def
closeSession
(
self
):
self
.
__movePrevSessionConfigs
(
True
)
def
__movePrevSessionConfigs
(
self
,
restore
):
if
restore
:
if
self
.
tempEnv
:
os
.
rename
(
self
.
tempEnv
,
os
.
path
.
expanduser
(
'
~
'
+
os
.
sep
+
'
.irods
'
+
os
.
sep
+
'
irods_environment.json
'
))
if
self
.
tempIrodsA
:
os
.
rename
(
self
.
tempIrodsA
,
os
.
path
.
expanduser
(
'
~
'
+
os
.
sep
+
'
.irods
'
+
os
.
sep
+
'
.irodsA
'
))
else
:
uid
=
str
(
uuid
.
uuid1
())
envPath
=
os
.
path
.
expanduser
(
'
~
'
+
os
.
sep
+
'
.irods
'
+
os
.
sep
+
'
irods_environment.json
'
)
irodsAPath
=
os
.
path
.
expanduser
(
'
~
'
+
os
.
sep
+
'
.irods
'
+
os
.
sep
+
'
.irodsA
'
)
if
os
.
path
.
exists
(
envPath
):
os
.
rename
(
envPath
,
envPath
+
uid
)
self
.
tempEnv
=
envPath
+
uid
if
os
.
path
.
exists
(
irodsAPath
):
os
.
rename
(
irodsAPath
,
irodsAPath
+
uid
)
self
.
tempIrodsA
=
irodsAPath
+
uid
def
getData
(
self
):
ticket
=
Ticket
(
self
.
session
,
self
.
token
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment