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

Write an isAuthor method? #54

Closed
kaushalmall opened this issue Nov 12, 2013 · 4 comments · Fixed by #568
Closed

Write an isAuthor method? #54

kaushalmall opened this issue Nov 12, 2013 · 4 comments · Fixed by #568

Comments

@kaushalmall
Copy link
Contributor

Does it help to write a utils method to get check the sling runmode and return an isAuthor boolean? I can do it, but, need to know from you guys if I should create a new SlingUtils class or add this to an existing class.

Let me know what you thinks.

Thanjs

@davidjgonzalez
Copy link
Contributor

I think just a isAuthor(..) method would be overkill since we have slingSettingsService.getRunModes().contains("author")

If it was part of a broader Util full of handy tolls for out-of-HTTPRequest context, then it would be a different story.

(If im in the context of a HTTP Request I (almost) always want to use WCMMode rather than runmodes.)

@justinedelson
Copy link
Contributor

I could see this being useful if it was a static. That requires jumping through some hoops to get this value set in a static context. Probably an immediate component which sets the values on startup. Runmodes can't be changed at runtime, so this is OK to do once.

If so, I'd like to see

isAuthor()
isPublish()
isRunmode(String)

@kaushalmall
Copy link
Contributor Author

@davidjgonzalez I thought WCMMode was never a good way to differentiate between being on author or publish. IIRC @justinedelson is a proponent of this.

@justinedelson are you talking about creating a OSGi component that sets the values on startup? I would love to do this, but, might (read will) need direction to get me started.

@davidjgonzalez
Copy link
Contributor

@kaushalmall WCMModes don't differentiate between author and publish instances; but can differentiate between intended publish and author behaviors. Within HTTP Request scoped-behaviors (Components/Servlets/etc.) the idea of the author/publish runmode is (normally) just an abstraction around WCMMode types.

Creating hard in-code deps on Author or Publish make it more difficult to experience the behavior on Author as it would on Publish.

Runmodes typically play a role in changing backend behaviors (WF, Listeners, Jobs, etc.) that need to behave differently based on the tier.

Of course, as with anything there are exceptions.

IIRC @jayk is a proponent of WCMModes :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants