locked
Need idea for User Right table design and how to fetch data RRS feed

  • Question

  • User264732274 posted

    now i am doing below way but this is not right way.

                    string sql = "";
                    sql = "SELECT Forms_Control.Forms_Name, Forms_Control.Controls_Name,Forms_Control.Controls_Text,";
                    sql = sql + "isnull(UserRights.IsEnabled,0) as IsEnabled ";
                    sql = sql + "FROM Forms_Control LEFT OUTER JOIN ";
                    sql = sql + "UserRights ON Forms_Control.Forms_Name =";
                    sql = sql + "UserRights.Forms_Name and ";
                    sql = sql + "Forms_Control.controls_Name = userrights.Controls_Name  ";
                    sql = sql + "and userrights.UserID='" + cboEmployee.SelectedValue.ToString() + "'";
                    sql = sql + " Where Forms_Control.Forms_Name='" + cboforms.SelectedValue.ToString()+ "' ";
                    sql = sql + "Order by Forms_Control.Forms_Name,Forms_Control.Controls_Name";
    

    suppose i have one table for User where userid ,user name and other details will be saved.

    in other table will be like User_Roles

    where userid and roleid will be saved. and another table will be there where roles will be there like roleid and name (admin/accounts/sales etc)

    now tell me how to fetch data joining 3 table as a result i could show user wise role details from where people give access to users.

    please discuss what best standard follows in software development for giving access to many user for pages.

    any project exist which i can download and browse its source code to how people design user management for web application. please share url and also discuss my issue which i post here. thanks

    Tuesday, November 17, 2015 9:33 AM

Answers

  • User1644755831 posted

    Hello sudip_inn,

    please discuss what best standard follows in software development for giving access to many user for pages.

    Usually you just do join for the tables you mentioned and show the permission in the UI per user wise and give them access. But Are you saying you want to batch update permission for users for that page? What I would do is that get a list of pages and for each page I would get the list of users and they have permission or not. You could show checkboxes beside the list of users for each user and then update it to give batch permission.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 17, 2015 8:53 PM

All replies

  • User379720387 posted

    In VS create a new site based on the Razor 3 template.

    All the functionality is there, including tables, membership and roles.

    It uses the Microsoft Simple Membership provider.

    Tuesday, November 17, 2015 3:12 PM
  • User1644755831 posted

    Hello sudip_inn,

    please discuss what best standard follows in software development for giving access to many user for pages.

    Usually you just do join for the tables you mentioned and show the permission in the UI per user wise and give them access. But Are you saying you want to batch update permission for users for that page? What I would do is that get a list of pages and for each page I would get the list of users and they have permission or not. You could show checkboxes beside the list of users for each user and then update it to give batch permission.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 17, 2015 8:53 PM
  • User264732274 posted
    How to assign permission to user. This kind things is there in mvc default template?
    Wednesday, November 18, 2015 1:08 AM