Skip to content

Commit

Permalink
Multi-ROLE user support
Browse files Browse the repository at this point in the history
  • Loading branch information
redsn0w422 committed Feb 18, 2017
1 parent 788824a commit 594b2e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion HackIllinois: QR/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>3</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
Expand Down
15 changes: 5 additions & 10 deletions HackIllinois: QR/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,12 @@ class BaseViewController: UIViewController {
func check_permissions(key: String) -> String {
let jwt: JWT = try! decode(jwt: key)
let json = JSON(jwt.body)
let role = json["roles"][0]["role"].rawString()
if (role == "STAFF" || role == "VOLUNTEER") {
return "SCAN"
}
else if (role == "ADMIN")
{
return "ADMIN"
}
else {
return "NONE"
let roles = json["roles"].arrayValue.map { (role) -> String in
return role.dictionaryValue["role"]!.stringValue
}
if roles.contains("ADMIN") { return "ADMIN" }
else if roles.contains("STAFF") || roles.contains("VOLUNTEER") { return "SCAN" }
else { return "NONE" }
}

func get_email(key: String) -> String {
Expand Down

0 comments on commit 594b2e4

Please sign in to comment.