0

I am working on PHP YII (Version 1.15) User management application.

My Scenario: A user can be assigned as supervisor and there are 'n' numbers of subordinates can assign to the user. Likewise, there are many supervisor available in the application. All users details falls in one table.

Objective: I want to give access to the supervisor to Edit and Delete only to the assigned subordinates. Other users data, he can't able to modify.

What I Tried: I am validating the call everytime before the supervisor clicks the edit button of the subordinates. (I have many forms, so have to use the code many places repeatedly)

Please help me to solve this issue.

Akilan
  • 1,707
  • 1
  • 16
  • 30

1 Answers1

0

Is it possible for you to add some column to your user table?

If it's possible, you should add one column in your user table that indicates the user's supervisor. It can contain the supervisor ID. Supervisors have null value for this column, so this column should be nullable. You can use the value of this column to validate supervisor's access to Edit and Delete by matching the ID of supervisor with this column's value.

MCRmy
  • 31
  • 1
  • 7