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 8616827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:42:41+00:00 2026-06-12T05:42:41+00:00

So I have a case where I have one action that will (based on

  • 0

So I have a case where I have one action that will (based on some conditions) flip over to another action in the same controller.

Now the initial action is allowed to people with a given role (coaches or trainers), but a subsequent action is only allowed to coaches.

However, because they’re not accessing the second action directly, (only via the intermediary action) the Auth Component doesn’t prevent it from firing. Here’s some code:

public function isAuthorized($user) {
    switch($this->action) {
        case "bulkAction":
            if ($user['role'] == ('coach' || 'trainer') ) {
                return true;
            }
            break;
        case "bulkDelete":
            if ($user['role'] == 'coach') {
                return true;
            }
            break;
    }
    return parent::isAuthorized($user);
}

public function bulkAction() {
    switch($this->request->data['Action']) {
        case "delete":
            $this->bulkDelete();
            break;
    }
}

So again, when bulkAction sends data over to the bulkDelete action, Auth seems to be completely bypassed, and the action goes through. How can I make sure that actions called by other actions are still checked against the controller’s isAuthorized callback?

  • 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-12T05:42:42+00:00Added an answer on June 12, 2026 at 5:42 am

    First off one action calling another is really bad design and should not be done. All your users should be calling only the bulkAction($type = null) action. Use the argument $type to specify the type. So your urls would be like /foo/bulkAction/edit /foo/bulkAction/delete etc. and your $type param will receive the value “edit”, “delete” etc. Make various protected methods in the controller which contain functionality for each type and call them as needed through your bulkAction. Then in your isAuthorised() method return true or false by checking the user role and the type which will be available in $this->request->params[‘passed’]. Instead of using param for the action you can also use named params if you like, so the action will be use bulkAction() and your urls would be like /foo/bulkAction/type:delete. In this case you can get the type using $this->request->params[‘named’].

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

Sidebar

Related Questions

I have two functions whose underlying logic is the same but in one case
I have one XML with 20 fields in my case based on type we
Given a case where I have an object that may be in one or
I have a case in which I have to start some non-UI action N
I have 2 classes. One will be a basic instructions screen and on that
I have a List of Tasks that a user can preform. Each one will
Case One Say you have a little class: class Point3D { private: float x,y,z;
I have a similar case as the one described here: Dynamically change RESTEasy service
I have a case where i have three entities with one-to-many and one-to-many relationships:
I have the following case in php $one = array('one' => 1, 2 =>

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.