Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8208115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:14:00+00:00 2026-06-07T09:14:00+00:00

I am currently creating an app where users can create and apply for jobs.

  • 0

I am currently creating an app where users can create and apply for jobs. However as I am fairly new to rails I am facing a fairly significant security feature in that if any user knows the correct path, for example:

 localhost:3000/users/user_id/apps

Then they can see any application made by any user for any job!

I am fairly sure that I need to use a before_filter to check that the current_user.id matches either the user_id found in my jobs table for each job or matches the user_id found in my applications table.

I am really not sure how to structure this though or where to apply the filter – for example is it better to create the filter in the application controller and then apply a skip_before_filter instance where needed.

Any help people can offer on contructing this code and where to place it would be much appreciated! Thanks 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T09:14:03+00:00Added an answer on June 7, 2026 at 9:14 am

    Before you start looking at authorization solutions such as cancan, a simple approach is to avoid doing

    App.find params[:id]
    

    Since an app is associated to a user and you’ve got current_user setup you can do

    app = current_user.apps.find params[:id]
    

    Which will only find apps associated with the user, no matter what the parameters to find.

    Where cancan really comes into its own is when you need a more complicated who can do what system. For example a user might be able to edit any job they’ve created but view (and not edit) another set of jobs.

    For example

    can :manage, Project, :user.id  => user.id
    can :read, Project, :department => user.department 
    

    This would allow users full access to any of their projects and read access to projects in their department

    Another thing about cancan is that rather than having before_filters or macros scattered around your controllers you declare the rules in one place, so it’s usually easier to see what’s going on. There’s loads more info on the cancan wiki an a railscast too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently creating an app where users have the possibility to create questions for
I am currently creating a Dashboard app which is created with Ruby on Rails.
I am currently creating an app and would like to create a demo version
I have a rails app where users share specific kinds of photos. Currently the
I'm currently creating an iPhone app (Xcode 4.3.1, IOS 5) that could use Bluetooth
I am currently creating an iOS app, which connects to a database and asynchronously
I'm currently creating an iPhone app and we need some testing with about 20~30
so here is the problem. I am currently creating an Android app that is
im currently creating a graph for an app, using coreplot and have a problem
I'm currently creating a iOS 5 iPad app where there will be heavy network

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.