Search in sources :

Example 6 with CustomBrutauthRules

use of br.com.caelum.brutauth.auth.annotations.CustomBrutauthRules in project mamute by caelum.

the class TagPageController method editTagPage.

@Post
@CustomBrutauthRules(ModeratorOnlyRule.class)
public void editTagPage(String tagName, MarkedText about) {
    TagPage tagPage = tagPages.findByTag(tagName);
    tagPage.setAbout(about);
    if (!validator.validate(tagPage)) {
        validator.onErrorRedirectTo(TagPageController.class).editTagPageForm(tagPage.getTagName());
        return;
    }
    result.redirectTo(this).showTagPage(tagPage.getTagName());
}
Also used : TagPage(org.mamute.model.TagPage) CustomBrutauthRules(br.com.caelum.brutauth.auth.annotations.CustomBrutauthRules) Post(br.com.caelum.vraptor.Post)

Example 7 with CustomBrutauthRules

use of br.com.caelum.brutauth.auth.annotations.CustomBrutauthRules in project mamute by caelum.

the class TagPageController method editTagPageForm.

@Get
@CustomBrutauthRules(ModeratorOnlyRule.class)
public void editTagPageForm(String tagName) {
    TagPage tagPage = tagPages.findByTag(tagName);
    result.include("tagPage", tagPage);
}
Also used : TagPage(org.mamute.model.TagPage) CustomBrutauthRules(br.com.caelum.brutauth.auth.annotations.CustomBrutauthRules) Get(br.com.caelum.vraptor.Get)

Example 8 with CustomBrutauthRules

use of br.com.caelum.brutauth.auth.annotations.CustomBrutauthRules in project mamute by caelum.

the class WatchController method watch.

@Post
@CustomBrutauthRules(LoggedRule.class)
public void watch(Long watchableId, String type) {
    Watchable watchable = watchers.findWatchable(watchableId, mapping.getClassFor(type));
    User user = currentUser.getCurrent();
    Watcher watcher = new Watcher(user);
    watchers.addOrRemove(watchable, watcher);
    result.nothing();
}
Also used : User(org.mamute.model.User) LoggedUser(org.mamute.model.LoggedUser) Watchable(org.mamute.model.interfaces.Watchable) Watcher(org.mamute.model.watch.Watcher) CustomBrutauthRules(br.com.caelum.brutauth.auth.annotations.CustomBrutauthRules) Post(br.com.caelum.vraptor.Post)

Example 9 with CustomBrutauthRules

use of br.com.caelum.brutauth.auth.annotations.CustomBrutauthRules in project mamute by caelum.

the class HibernateStatisticsController method show.

@Get("/alsjkdalkjsjdhadskj")
@CustomBrutauthRules(ModeratorOnlyRule.class)
public void show() {
    Statistics statistics = sf.getStatistics();
    result.include("s", statistics);
}
Also used : Statistics(org.hibernate.stat.Statistics) CustomBrutauthRules(br.com.caelum.brutauth.auth.annotations.CustomBrutauthRules) Get(br.com.caelum.vraptor.Get)

Example 10 with CustomBrutauthRules

use of br.com.caelum.brutauth.auth.annotations.CustomBrutauthRules in project mamute by caelum.

the class NewsController method saveEdit.

@Post
@CustomBrutauthRules(EditNewsRule.class)
public void saveEdit(@Load News news, String title, MarkedText description, String comment) {
    Information newInformation = new NewsInformation(title, description, currentUser, comment);
    news.enqueueChange(newInformation, UpdateStatus.NO_NEED_TO_APPROVE);
    result.redirectTo(this).showNews(news, news.getSluggedTitle());
}
Also used : NewsInformation(org.mamute.model.NewsInformation) Information(org.mamute.model.Information) NewsInformation(org.mamute.model.NewsInformation) CustomBrutauthRules(br.com.caelum.brutauth.auth.annotations.CustomBrutauthRules) Post(br.com.caelum.vraptor.Post)

Aggregations

CustomBrutauthRules (br.com.caelum.brutauth.auth.annotations.CustomBrutauthRules)12 Post (br.com.caelum.vraptor.Post)9 Watcher (org.mamute.model.watch.Watcher)4 Get (br.com.caelum.vraptor.Get)3 TagPage (org.mamute.model.TagPage)3 EmailAction (org.mamute.mail.action.EmailAction)2 LoggedUser (org.mamute.model.LoggedUser)2 NewsInformation (org.mamute.model.NewsInformation)2 Tag (org.mamute.model.Tag)2 User (org.mamute.model.User)2 Watchable (org.mamute.model.interfaces.Watchable)2 SimpleBrutauthRules (br.com.caelum.brutauth.auth.annotations.SimpleBrutauthRules)1 ArrayList (java.util.ArrayList)1 Statistics (org.hibernate.stat.Statistics)1 FlaggableAndFlagCount (org.mamute.dto.FlaggableAndFlagCount)1 QuestionCreated (org.mamute.event.QuestionCreated)1 org.mamute.model (org.mamute.model)1 Answer (org.mamute.model.Answer)1 Comment (org.mamute.model.Comment)1 Information (org.mamute.model.Information)1