Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository 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
Hsin-Yu Chien
edx-platform-release
Commits
66e0f6bf
Commit
66e0f6bf
authored
4 years ago
by
Alexander Sheehan
Browse files
Options
Downloads
Patches
Plain Diff
caching enterprise learner lookup
parent
440773a7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openedx/features/enterprise_support/utils.py
+10
-1
10 additions, 1 deletion
openedx/features/enterprise_support/utils.py
with
10 additions
and
1 deletion
openedx/features/enterprise_support/utils.py
+
10
−
1
View file @
66e0f6bf
...
...
@@ -7,6 +7,7 @@ import json
from
crum
import
get_current_request
from
django.conf
import
settings
from
django.core.cache
import
cache
from
django.urls
import
NoReverseMatch
,
reverse
from
django.utils.translation
import
ugettext
as
_
from
edx_django_utils.cache
import
TieredCache
,
get_cache_key
...
...
@@ -401,7 +402,15 @@ def is_enterprise_learner(user):
Returns:
(bool): True if given user is an enterprise learner.
"""
return
EnterpriseCustomerUser
.
objects
.
filter
(
user_id
=
user
.
id
).
exists
()
cached_is_enterprise_key
=
'
{}:user_is_enterprise
'
.
format
(
user
.
id
)
if
cache
.
get
(
cached_is_enterprise_key
):
return
True
if
EnterpriseCustomerUser
.
objects
.
filter
(
user_id
=
user
.
id
).
exists
():
# Cache the enterprise user for one hour.
cache
.
set
(
cached_is_enterprise_key
,
True
,
expiry
=
3600
)
return
True
return
False
def
get_enterprise_slug_login_url
():
...
...
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