##// END OF EJS Templates
Modified logged_in_user_membership controller method so that it returns a role...
Jean-Philippe Lang -
r412:8e6d575d4e86
parent child
Show More
@@ -32,8 +32,10 class ApplicationController < ActionController::Base
32 end
32 end
33 end
33 end
34
34
35 # Returns the role that the logged in user has on the current project
36 # or nil if current user is not a member of the project
35 def logged_in_user_membership
37 def logged_in_user_membership
36 @user_membership ||= Member.find(:first, :conditions => ["user_id=? and project_id=?", self.logged_in_user.id, @project.id])
38 @user_membership ||= logged_in_user.role_for_project(@project)
37 end
39 end
38
40
39 # check if login is globally required to access the application
41 # check if login is globally required to access the application
@@ -86,8 +88,7 class ApplicationController < ActionController::Base
86 # admin is always authorized
88 # admin is always authorized
87 return true if self.logged_in_user.admin?
89 return true if self.logged_in_user.admin?
88 # if not admin, check membership permission
90 # if not admin, check membership permission
89 @user_membership ||= logged_in_user.role_for_project(@project)
91 if logged_in_user_membership and Permission.allowed_to_role( "%s/%s" % [ ctrl, action ], logged_in_user_membership )
90 if @user_membership and Permission.allowed_to_role( "%s/%s" % [ ctrl, action ], @user_membership )
91 return true
92 return true
92 end
93 end
93 render :nothing => true, :status => 403
94 render :nothing => true, :status => 403
General Comments 0
You need to be logged in to leave comments. Login now