-
Notifications
You must be signed in to change notification settings - Fork 4
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
Switch auth system to cancan WIP #69
Conversation
class Ability | ||
include CanCan::Ability | ||
|
||
def initialize(user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused method argument - user
. If it's necessary, use _
or _user
as an argument name to indicate that it won't be used. You can also write as initialize(*)
if you want the method to accept any arguments but don't care about them.
How will we give a user permissions? Can it be done depending on their Post? |
@Zofz My proposal:
Then do something like |
Jag gillar @henrikssn lösning. Bättre att jobba på normalformen än att knacka in JSON-strängar i sin databas. JSONkolumner luktar lite som att man inte riktigt har koll på hur databaser funkar. Dock skulle jag inte använda HABTM. Jag vet att det lärs ut fortfarande men det är inte bra av två skäl:
|
Implementing more tests in #87 |
@@ -61,7 +61,7 @@ def candidates | |||
end | |||
private | |||
def authenticate | |||
flash[:error] = t('the_role.access_denied') | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
protect_from_forgery | ||
|
||
before_filter :configure_permitted_devise_parameters, if: :devise_controller? | ||
before_filter :set_locale | ||
before_filter :get_commit | ||
|
||
rescue_from CanCan::AccessDenied do |ex| | ||
flash[:error] = ex.message | ||
render :text => '', :layout => true, :status => :forbidden |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the new Ruby 1.9 hash syntax.
Conflicts: Gemfile Gemfile.lock app/controllers/application_controller.rb app/controllers/events_controller.rb app/controllers/posts_controller.rb app/controllers/static_pages_controller.rb app/views/layouts/_topbar.html.erb app/views/layouts/_utskottmenu.html.erb app/views/posts/_post.html.erb config/routes.rb db/schema.rb
@@ -101,12 +100,24 @@ def destroy | |||
|
|||
private | |||
def authenticate | |||
<<<<<<< HEAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tLSHFT
before_action :set_post, only: [:show, :edit, :update, :destroy, :remove_profile,:add_profile_username, :display] | ||
|
||
def remove_profile | ||
@profile = Profile.find_by_id(params[:profile_id]) | ||
@post.profiles.delete(@profile) | ||
respond_to do |format| | ||
format.html { redirect_to council_posts_path(@council), notice: @profile.name.to_s + ' har inte längre posten ' + @post.title.to_s + '.'} | ||
format.html { redirect_to council_posts_path(@council), notice: @profile.name.to_s + ' har inte längre posten ' + @post.title.to_s + '.'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [143/100]
Space missing inside }.
@fsek/admins Will merge this later today or tomorrow. Please take a look. |
Looks like great work @henrikssn |
rescue ActionController::RedirectBackError | ||
redirect_to root_path | ||
|
||
def set_councils |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
Merging when test results arrive... |
Switch auth system to cancan WIP
Fingers crossed 👌 |
This PR was deployed to Production. Reference: 86e473e |
👍 |
This PR will migrate the code base from TheRole to cancancan.
Solves #67 and needs #68
Note: Work in progress, help is very welcome!