Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Making more use of Permissions #3170


User avatar
0
bilalhaidar created

Hi, In my app, I am about to start developing a survey system whereby users can create new Surveys and fill them.

A user would need to find a list of Surveys that he/she has access to.

How can I make use of Permission system to do so?

I thought of creating a new Permission with every new Survey, but the framework doesn't allow this.

Another option would be to assign the Survey to 1 or more roles, those who belong to those roles can run the Survey.

Any suggestion on how to proceed?

Thanks


5 Answer(s)
  • User Avatar
    0
    tteoh created

    Hi, I am sure if using role to achieve above is such a good idea.

    You probably need to customize a survey assignment table that has a FK to AbpUsers table. From there, you could filter the survey based on Current UserId against the assignments - My Assigned Surveys.

    Just wonder if the current data filter class (for tenancy) is a good candidate or just implement the filter as application logic part of survey table/Repository filter.

    Perhaps, Support has a better recommendation.

    Thanks, /tommy

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @drcgreece,

    I think permissions are not suitable for this purpose. I agree with @tteoh, it is better to handle User's serveys using a table with UserId included.

  • User Avatar
    0
    bilalhaidar created

    Thanks everyone. I was confused between using Permission or Roles

    Maybe a RoleId is better as this way I can assign the same Survey to more than one users by just adding them to the role.

    Thank you

  • User Avatar
    0
    tteoh created

    Hi Bilal,

    Using Role assignment is also an interesting approach that does not require individual assignment. However, if the role is too specific, you may end with too many roles at system administration level.

    Definitely, it is a possible alternative. Something I will keep in mind.

    Thanks. /Tommy

  • User Avatar
    0
    bilalhaidar created

    Well, in my case, I am building a Survey system. For each new Survey designed and saved in the DB, some users need to be assigned to run this Survey. So I will make sure that for each Survey created, a new Role is created. Also, I will ask the Survey Designer to select which users can run this Survey and fill it. After that, I will programmatically create the Role and add all users in one shot.

    I might have many roles, but it will be much easier for the Admin of the app to add/remove users from Roles.