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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:47:27+00:00 2026-05-20T22:47:27+00:00

First, I am using EF 4.1 and utilizing the Repository and Unit Of Work

  • 0

First, I am using EF 4.1 and utilizing the Repository and Unit Of Work patterns. We are building a web applcaition.

I am beginning my project using the Code First approach for EF 4. Right now, the database doesn’t exist. So, I am trying to come up with a strategy to handle what data a user has access to and where that logic should sit in my framework.

Let’s say a user logs into the system and wants to create a user for the system. That form has a field to put that new user in some sort of role. The user tasked for creating this “new user” can only see certain types of roles (User, Creator, and Viewer) but we know that an Admin role exists, but this user doesn’t have access to it. When I call the service to give me that list of Roles, do I want to pull all the roles back, then build a new list based on some sort of permission set?

I am struggling with the idea of have some of this logic in my Repository, but really don’t think it fits there.

  • 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-05-20T22:47:27+00:00Added an answer on May 20, 2026 at 10:47 pm

    The security should be on multiple levels, but I think all would be higher than the repository. Your UI/Menuing shouldn’t expose functionality the user doesn’t have access too, but you should also check on the server, probably in an application service layer that the user has access to perform the action they are attempting.

    In the case of the user roles, you could build the role relationships into your data model, but I would bring them all back from the database and cache them and filter the list with code logic. But the question is how do you know what roles a user can add, or not add? You could use a specific number, leaving gaps, and only allow people of a certain role to create users of a role equal to or less than their own role.

    For instance:

    RoleID    Role
         1    Peon
         5    Common Folk
         10   King
         15   Supreme Master of the Universe
    

    So maybe only Kings and SMU’s have the ability to add new users. SMU’s can create other SMU’s, Kings, Common Folk, and Peons. Kings can do the same, minus SMU’s. The gaps in the ids give you the ability to add more roles later without renumbering.

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

Sidebar

Related Questions

A bit of background first: I am using base code from a remote SVN
This is my first experience using the Zend Framework. I am attempting to follow
When I first started using revision control systems like CVS and SVN , I
This is my first time using joomla. I don't know if I'm using the
I'm setting up my first site using the asp authentication provider and using the
I am currently trying to program my first ajax interface using Rails. The application
I'm interested in putting together my first online game using Flash as the client
I'm trying to figure out how to implement my first RESTful interface using Django
Okay, so I'm doing my first foray into using the ADO.NET Entity Framework. My
[1] In JDBC, why should we first load drivers using Class.forName(some driver name). Why

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.