Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
仰若水
frappe
Commits
c1cf48b9
Commit
c1cf48b9
authored
8 years ago
by
Nabin Hait
Browse files
Options
Download
Plain Diff
Merge branch 'hotfix'
parents
c1155eb6
575a6ed4
develop
v11.1.5
v11.1.4
v11.1.3
v11.1.2
v11.1.1
v11.1.0
v11.0.3
v11.0.3-beta.51
v11.0.3-beta.50
v11.0.3-beta.49
v11.0.3-beta.48
v11.0.3-beta.47
v11.0.3-beta.46
v11.0.3-beta.45
v11.0.3-beta.44
v11.0.3-beta.43
v11.0.3-beta.42
v11.0.3-beta.41
v11.0.3-beta.40
v11.0.3-beta.39
v11.0.3-beta.38
v11.0.3-beta.37
v11.0.3-beta.36
v11.0.3-beta.35
v11.0.3-beta.34
v11.0.3-beta.33
v11.0.3-beta.32
v11.0.3-beta.31
v11.0.3-beta.30
v11.0.3-beta.29
v11.0.3-beta.28
v11.0.3-beta.27
v11.0.3-beta.26
v11.0.3-beta.25
v11.0.3-beta.24
v11.0.3-beta.23
v11.0.3-beta.22
v11.0.3-beta.21
v11.0.3-beta.20
v11.0.3-beta.19
v11.0.3-beta.18
v11.0.3-beta.17
v11.0.3-beta.16
v11.0.3-beta.15
v11.0.3-beta.14
v11.0.3-beta.13
v11.0.3-beta.12
v11.0.3-beta.11
v11.0.3-beta.10
v11.0.3-beta.9
v11.0.3-beta.8
v11.0.3-beta.7
v11.0.3-beta.6
v11.0.3-beta.5
v11.0.3-beta.4
v11.0.3-beta.3
v11.0.3-beta.2
v11.0.3-beta.1
v11.0.2
v11.0.1
v11.0.0-beta
v10.1.71
v10.1.70
v10.1.69
v10.1.68
v10.1.67
v10.1.66
v10.1.65
v10.1.64
v10.1.63
v10.1.62
v10.1.61
v10.1.60
v10.1.59
v10.1.58
v10.1.57
v10.1.56
v10.1.55
v10.1.54
v10.1.53
v10.1.52
v10.1.51
v10.1.50
v10.1.49
v10.1.49-beta.1
v10.1.48
v10.1.47
v10.1.46
v10.1.45
v10.1.44
v10.1.43
v10.1.42
v10.1.41
v10.1.40
v10.1.39
v10.1.38
v10.1.37
v10.1.36
v10.1.35
v10.1.34
v10.1.33
v10.1.32
v10.1.31
v10.1.30
v10.1.29
v10.1.28
v10.1.27
v10.1.26
v10.1.25
v10.1.24
v10.1.23
v10.1.22
v10.1.21
v10.1.20
v10.1.19
v10.1.18
v10.1.17
v10.1.16
v10.1.15
v10.1.14
v10.1.13
v10.1.12
v10.1.11
v10.1.10
v10.1.9
v10.1.8
v10.1.7
v10.1.6
v10.1.5
v10.1.4
v10.1.3
v10.1.2
v10.1.1
v10.1.0
v10.0.25
v10.0.24
v10.0.23
v10.0.22
v10.0.21
v10.0.20
v10.0.19
v10.0.18
v10.0.17
v10.0.16
v10.0.15
v10.0.14
v10.0.13
v10.0.12
v10.0.11
v10.0.10
v10.0.9
v10.0.8
v10.0.7
v10.0.6
v10.0.5
v10.0.4
v10.0.3
v10.0.2
v10.0.1
v10.0.0
v9.2.25
v9.2.24
v9.2.23
v9.2.22
v9.2.21
v9.2.20
v9.2.19
v9.2.18
v9.2.17
v9.2.16
v9.2.15
v9.2.14
v9.2.13
v9.2.12
v9.2.11
v9.2.10
v9.2.9
v9.2.8
v9.2.7
v9.2.6
v9.2.5
v9.2.4
v9.2.3
v9.2.2
v9.2.1
v9.2.0
v9.1.11
v9.1.10
v9.1.9
v9.1.8
v9.1.7
v9.1.6
v9.1.5
v9.1.4
v9.1.3
v9.1.2
v9.1.1
v9.1.0
v9.0.10
v9.0.9
v9.0.8
v9.0.7
v9.0.6
v9.0.5
v9.0.4
v9.0.3
v9.0.2
v9.0.1
v9.0.0
v8.10.9
v8.10.8
v8.10.7
v8.10.6
v8.10.5
v8.10.4
v8.10.3
v8.10.2
v8.10.1
v8.10.0
v8.9.4
v8.9.3
v8.9.2
v8.9.1
v8.9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
v7.2.19
v7.2.18
v7.2.17
v7.2.16
v7.2.15
v7.2.14
v7.2.13
v7.2.12
v7.2.11
No related merge requests found
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
frappe/__init__.py
+1
-1
frappe/__init__.py
frappe/auth.py
+1
-1
frappe/auth.py
frappe/commands/utils.py
+3
-2
frappe/commands/utils.py
frappe/core/doctype/communication/email.py
+6
-5
frappe/core/doctype/communication/email.py
frappe/core/doctype/communication/feed.py
+9
-0
frappe/core/doctype/communication/feed.py
frappe/core/doctype/doctype/doctype.py
+2
-1
frappe/core/doctype/doctype/doctype.py
frappe/sessions.py
+14
-6
frappe/sessions.py
with
36 additions
and
16 deletions
+36
-16
frappe/__init__.py
View file @
c1cf48b9
...
...
@@ -13,7 +13,7 @@ import os, sys, importlib, inspect, json
from
.exceptions
import
*
from
.utils.jinja
import
get_jenv
,
get_template
,
render_template
__version__
=
'7.2.1
0
'
__version__
=
'7.2.1
1
'
__title__
=
"Frappe Framework"
local
=
Local
()
...
...
This diff is collapsed.
Click to expand it.
frappe/auth.py
View file @
c1cf48b9
...
...
@@ -255,7 +255,7 @@ class LoginManager:
self
.
run_trigger
(
'on_logout'
)
if
user
==
frappe
.
session
.
user
:
delete_session
(
frappe
.
session
.
sid
)
delete_session
(
frappe
.
session
.
sid
,
user
=
user
,
reason
=
"User Manually Logged Out"
)
self
.
clear_cookies
()
else
:
clear_sessions
(
user
)
...
...
This diff is collapsed.
Click to expand it.
frappe/commands/utils.py
View file @
c1cf48b9
...
...
@@ -52,15 +52,16 @@ def clear_website_cache(context):
frappe
.
destroy
()
@
click
.
command
(
'destroy-all-sessions'
)
@
click
.
option
(
'--reason'
)
@
pass_context
def
destroy_all_sessions
(
context
):
def
destroy_all_sessions
(
context
,
reason
=
None
):
"Clear sessions of all users (logs them out)"
import
frappe.sessions
for
site
in
context
.
sites
:
try
:
frappe
.
init
(
site
=
site
)
frappe
.
connect
()
frappe
.
sessions
.
clear_all_sessions
()
frappe
.
sessions
.
clear_all_sessions
(
reason
)
frappe
.
db
.
commit
()
finally
:
frappe
.
destroy
()
...
...
This diff is collapsed.
Click to expand it.
frappe/core/doctype/communication/email.py
View file @
c1cf48b9
...
...
@@ -336,12 +336,13 @@ def add_attachments(name, attachments):
# loop through attachments
for
a
in
attachments
:
attach
=
frappe
.
db
.
get_value
(
"File"
,
{
"name"
:
a
},
[
"file_name"
,
"file_url"
,
"is_private"
],
as_dict
=
1
)
if
isinstance
(
a
,
basestring
):
attach
=
frappe
.
db
.
get_value
(
"File"
,
{
"name"
:
a
},
[
"file_name"
,
"file_url"
,
"is_private"
],
as_dict
=
1
)
# save attachments to new doc
save_url
(
attach
.
file_url
,
attach
.
file_name
,
"Communication"
,
name
,
"Home/Attachments"
,
attach
.
is_private
)
# save attachments to new doc
save_url
(
attach
.
file_url
,
attach
.
file_name
,
"Communication"
,
name
,
"Home/Attachments"
,
attach
.
is_private
)
def
filter_email_list
(
doc
,
email_list
,
exclude
,
is_cc
=
False
):
# temp variables
...
...
This diff is collapsed.
Click to expand it.
frappe/core/doctype/communication/feed.py
View file @
c1cf48b9
...
...
@@ -58,6 +58,15 @@ def login_feed(login_manager):
"full_name"
:
get_fullname
(
login_manager
.
user
)
})
def
logout_feed
(
user
,
reason
):
if
not
user
:
return
add_info_comment
(
**
{
"subject"
:
_
(
"{0} logged out: <b>{1}</b>"
).
format
(
get_fullname
(
user
),
reason
),
"full_name"
:
get_fullname
(
user
),
})
def
get_feed_match_conditions
(
user
=
None
,
force
=
True
):
if
not
user
:
user
=
frappe
.
session
.
user
...
...
This diff is collapsed.
Click to expand it.
frappe/core/doctype/doctype/doctype.py
View file @
c1cf48b9
...
...
@@ -59,7 +59,8 @@ class DocType(Document):
self
.
make_amendable
()
self
.
validate_website
()
self
.
update_fields_to_fetch
()
if
not
self
.
is_new
():
self
.
update_fields_to_fetch
()
def
check_developer_mode
(
self
):
"""Throw exception if not developer mode or via patch"""
...
...
This diff is collapsed.
Click to expand it.
frappe/sessions.py
View file @
c1cf48b9
...
...
@@ -73,19 +73,27 @@ def clear_sessions(user=None, keep_current=False, device=None):
where user=%s and device=%s {condition}
order by lastupdate desc limit {limit}, 100"""
.
format
(
condition
=
condition
,
limit
=
limit
),
(
user
,
device
))):
delete_session
(
sid
)
delete_session
(
sid
,
reason
=
"Logged In From Another Session"
)
def
delete_session
(
sid
=
None
,
user
=
None
,
reason
=
"Session Expired"
):
from
frappe.core.doctype.communication.feed
import
logout_feed
def
delete_session
(
sid
=
None
,
user
=
None
):
frappe
.
cache
().
hdel
(
"session"
,
sid
)
frappe
.
cache
().
hdel
(
"last_db_session_update"
,
sid
)
if
sid
and
not
user
:
user_details
=
frappe
.
db
.
sql
(
"""select user from tabSessions where sid=%s"""
,
sid
,
as_dict
=
True
)
if
user_details
:
user
=
user_details
[
0
].
get
(
"user"
)
logout_feed
(
user
,
reason
)
frappe
.
db
.
sql
(
"""delete from tabSessions where sid=%s"""
,
sid
)
frappe
.
db
.
commit
()
def
clear_all_sessions
():
def
clear_all_sessions
(
reason
=
None
):
"""This effectively logs out all users"""
frappe
.
only_for
(
"Administrator"
)
if
not
reason
:
reason
=
"Deleted All Active Session"
for
sid
in
frappe
.
db
.
sql_list
(
"select sid from `tabSessions`"
):
delete_session
(
sid
)
delete_session
(
sid
,
reason
=
reason
)
def
clear_expired_sessions
():
"""This function is meant to be called from scheduler"""
...
...
@@ -93,7 +101,7 @@ def clear_expired_sessions():
for
sid
in
frappe
.
db
.
sql_list
(
"""select sid from tabSessions
where TIMEDIFF(NOW(), lastupdate) > TIME(%s)
and device = %s"""
,
(
get_expiry_period
(
device
),
device
)):
delete_session
(
sid
)
delete_session
(
sid
,
reason
=
"Session Expired"
)
def
get
():
"""get session boot info"""
...
...
@@ -310,7 +318,7 @@ class Session:
return
(
cint
(
parts
[
0
])
*
3600
)
+
(
cint
(
parts
[
1
])
*
60
)
+
cint
(
parts
[
2
])
def
delete_session
(
self
):
delete_session
(
self
.
sid
)
delete_session
(
self
.
sid
,
reason
=
"Session Expired"
)
def
start_as_guest
(
self
):
"""all guests share the same 'Guest' session"""
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help