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

  • Home
  • SEARCH
  • 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 7775981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:45:41+00:00 2026-06-01T17:45:41+00:00

how to make the registered user can edit only their data but not others.

  • 0

how to make the registered user can edit only their data but not others. When it was set up ACL(aro and aco).
My settings:

class User extends AppModel {

public function bindNode($user) {

    return array('model' => 'Group', 'foreign_key' => $user['User']['group_id']);

}

class AppController extends Controller {

public $components = array(
    'Acl',
    'Auth' => array(
        'authorize' => array(
            'Actions' => array('actionPath' => 'controllers')
        )
    ),
    'Session'
);
  • 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-01T17:45:43+00:00Added an answer on June 1, 2026 at 5:45 pm

    You should add the isAuthorized method to your controller. In this method you check that the users are authorized for the actions they are trying to do with the parameters they are passing. You could use code like this:

    switch ($this->action) {
        case 'delete':
        case 'edit':
            // id of what they are trying to edit
            $this->Topic->id = $this->params['pass'][0];
            // id of the owner of what they are trying to edit
            $ownerId = $this->Topic->field('user_id');
    
            $userId = $this->Auth->user('id');
            if ($ownerId == $userId) {
                // allow users to edit or delete their own topics
                return TRUE;
            } else {
                // allow admin group to edit any topic
                return $this->Auth->user('group') == 'admin';
            }
    }
    

    If you want to use Cake’s ACL system for checking permissions rather than hard-coding checks like “user is a member of admin group”, see the tutorial here: http://jonisalonen.com/2010/role-based-acl-in-cakephp/
    It was written for Cake 1.3 though, I haven’t checked if there are major differences.

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

Sidebar

Related Questions

I want to data mine dribbble.com so I can make an app that registers
I am creating a site where each registered user can store a list of
I have the following admin setup so that I can add/edit a user and
When you authenticate registered users you make request e.g. one examples i found: $user
I make an AJAX request to see if a sesion variable has been set.
I'm trying to make a simple email notification when a user signs up. My
I already have written a login and register script. The user can login to
I'm trying to make a ASP.NET (C#) poll that will ask a user a
Say that I have an application where user can upload his avatar, and then
I have a ASP.NET page with 2 user controls registered. The first one has

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.