• Y
  • List All
  • Feedback
    • This Project
    • All Projects
Profile Account Log out
  • Favorite
  • Project
  • Recent History
Loading...
  • Log in
  • Sign up
kadrians / Testing_for_YONA star
  • Project homeH
  • CodeC
  • IssueI 1
  • Pull requestP
  • Review R
  • MilestoneM
  • BoardB 2
  • Files
  • Commit
  • Branches
Testing_for_YONAsourceappactionsIsAllowedAction.java
Download as .zip file
File name
Commit message
Commit date
bin
Yona 1.16.0 Upload
02-04
lib
Yona 1.16.0 Upload
02-04
share/doc/api
Yona 1.16.0 Upload
02-04
source
Source Code Upload
02-04
README.md
Yona 1.16.0 Upload
02-04
File name
Commit message
Commit date
app
Source Code Upload
02-04
conf
Source Code Upload
02-04
docs
Source Code Upload
02-04
lib
Source Code Upload
02-04
project
Source Code Upload
02-04
public
Source Code Upload
02-04
support-script
Source Code Upload
02-04
test
Source Code Upload
02-04
.gitignore
Source Code Upload
02-04
.mailmap
Source Code Upload
02-04
.travis.yml
Source Code Upload
02-04
AUTHORS
Source Code Upload
02-04
LICENSE
Source Code Upload
02-04
NOTICE
Source Code Upload
02-04
README.md
Source Code Upload
02-04
build.sbt
Source Code Upload
02-04
dev.sh
Source Code Upload
02-04
dist.sh
Source Code Upload
02-04
is-alive-bot.sh
Source Code Upload
02-04
minify-js.sh
Source Code Upload
02-04
restart.sh
Source Code Upload
02-04
File name
Commit message
Commit date
actions
Source Code Upload
02-04
actors
Source Code Upload
02-04
assets/stylesheets
Source Code Upload
02-04
controllers
Source Code Upload
02-04
data
Source Code Upload
02-04
errors
Source Code Upload
02-04
mailbox
Source Code Upload
02-04
models
Source Code Upload
02-04
notification
Source Code Upload
02-04
playRepository
Source Code Upload
02-04
service
Source Code Upload
02-04
utils
Source Code Upload
02-04
validation
Source Code Upload
02-04
views
Source Code Upload
02-04
Global.java
Source Code Upload
02-04
File name
Commit message
Commit date
support
Source Code Upload
02-04
AbstractProjectCheckAction.java
Source Code Upload
02-04
AnonymousCheckAction.java
Source Code Upload
02-04
CodeAccessCheckAction.java
Source Code Upload
02-04
DefaultProjectCheckAction.java
Source Code Upload
02-04
GuestProhibitAction.java
Source Code Upload
02-04
IsAllowedAction.java
Source Code Upload
02-04
IsCreatableAction.java
Source Code Upload
02-04
IsOnlyGitAvailableAction.java
Source Code Upload
02-04
NullProjectCheckAction.java
Source Code Upload
02-04
Nell 02-04 2600fe6 Source Code Upload UNIX
Raw Open in browser Change history
/** * Yobi, Project Hosting SW * * Copyright 2013 NAVER Corp. * http://yobi.io * * @author Keesun Baik * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package actions; import actions.support.PathParser; import controllers.UserApp; import controllers.annotation.IsAllowed; import models.Project; import models.enumeration.Operation; import models.enumeration.ResourceType; import models.resource.Resource; import models.resource.ResourceConvertible; import play.libs.F.Promise; import play.mvc.Http.Context; import play.mvc.Result; import utils.AccessControl; import utils.AccessLogger; import utils.ErrorViews; /** * After {@link actions.AbstractProjectCheckAction}, * 1. Check if the resource of the certain type exists. * 2. Check if the current user is permitted to specified operation on the resource. * * For more specific, see {@link controllers.annotation.IsAllowed}. * * @author Keesun Baik * @see {@link AbstractProjectCheckAction} * @see {@link controllers.annotation.IsAllowed} */ public class IsAllowedAction extends AbstractProjectCheckAction<IsAllowed> { @Override protected Promise<Result> call(Project project, Context context, PathParser parser) throws Throwable { ResourceType resourceType = this.configuration.resourceType(); ResourceConvertible resourceObject = Resource.getResourceObject(parser, project, resourceType); Operation operation = this.configuration.value(); if(resourceObject == null) { Promise<Result> promise = Promise.pure((Result) notFound(ErrorViews.NotFound.render("error.notfound", project, resourceType.resource()))); AccessLogger.log(context.request(), promise, null); return promise; } if(!AccessControl.isAllowed(UserApp.currentUser(), resourceObject.asResource(), operation)) { Promise<Result> promise = Promise.pure((Result) forbidden(ErrorViews.Forbidden.render("error.forbidden", project))); AccessLogger.log(context.request(), promise, null); return promise; } return this.delegate.call(context); } }

          
        
    
    
Copyright Yona authors & © NAVER Corp. & NAVER LABS Supported by NAVER CLOUD PLATFORM

or
login with Google Sign in with Google
Reset password | Sign up