Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LSR-931 Expose User object in SessionContext #361

Merged
merged 15 commits into from
Nov 23, 2016
Merged

Conversation

victorg1991
Copy link
Member

No description provided.

@dgarciasarai
Copy link
Contributor

👍 LGTM

@javiergamarra
Copy link
Contributor

👍

@jmnavarro jmnavarro added this to the 2.1.0 milestone Nov 23, 2016
@@ -72,7 +72,7 @@ public class LoginScreenlet: BaseScreenlet, BasicAuthBasedType {
viewModel.userName = SessionContext.currentContext?.basicAuthUsername
viewModel.password = SessionContext.currentContext?.basicAuthPassword

let userAttributes = SessionContext.currentContext!.userAttributes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a computed property called userAttributes to maintain backwards compatibility

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 in c5caab8

@@ -48,11 +48,11 @@ public class UpdateCurrentUserLiferayConnector: ServerConnector {
}

public func attributeAsString(key: String) -> String {
return SessionContext.currentContext?.userAttribute(key) as! String
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here: add userAttribute(key) method.
Keep in mind the Liskov Substitution Principle, or as a simple rule of thumb: don't chain more than one period in an expression (don't access one object internals, just ask the object to do something)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 2799c61

@@ -79,7 +79,7 @@ public class UserPortraitScreenlet: BaseScreenlet {
}

public func loadLoggedUserPortrait() -> Bool {
guard let userId = SessionContext.currentContext?.userId else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 in c5caab8


super.init()
}

private func int64Value(key: String) -> Int64? {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move these helper methods to somewhere?

@jmnavarro jmnavarro merged commit fd3f1f4 into develop Nov 23, 2016
@jmnavarro jmnavarro deleted the feature/LSR-931 branch November 23, 2016 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants