-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.R
59 lines (47 loc) · 1.62 KB
/
server.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
shinyServer(function(input, output, session) {
cat(file = stderr(), "\nstarting session...\n")
# local testing
# jwt = "***"
# jwt <- reactiveVal(jwt)
# publish to prod (no need to run successfully locally first)
jwt <- reactiveVal('NA')
jwt <- callModule(authentication_server, "authentication", jwt)
# SESSION DATA-----
# Store in a convenience variable
cdata <- session$clientData
# Values from cdata returned as text
output$clientdataText <- renderText({
cnames <- names(cdata)
allvalues <- lapply(cnames, function(name) {
paste(name, cdata[[name]], sep = " = ")
})
paste(allvalues, collapse = "\n")
})
#-------
observe({
role_check = check_role(jwt(), required_role)
print(role_check)
if (!is.null(role_check)){
if (role_check == TRUE){
callModule(jail_server, "jail")
showTab(inputId = "tabs", target = "Jail")
}}
})
hideTab(inputId = "tabs", target = "Jail")
output$warningbox <- renderUI({
role_check = check_role(jwt(), required_role)
if (is.null(role_check)) {
message = "You are currently not logged in to the OpenLattice Domain. To log in, either clear your browser cookies here or open a new tab and go to https://openlattice.com/orgs/#/, login and then refresh the dashboard."
} else if (!role_check) {
message = "You have insufficient permissions to see the dashboard. Please contact dashboard administrators for access."
} else {
return(NULL)
}
return(box(
status = "warning",
width =12,
align = "center",
tags$b(message)
))
})
})