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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:40:02+00:00 2026-05-29T03:40:02+00:00

I quite not sure about how it all should work. So I have an

  • 0

I quite not sure about how it all should work. So I have an aggregate in my domain model (Post->Feedbacks;Post->Category). And I’ve been thinking about place of User class. My first thought was to implement User class using state pattern:

interface IUserRole
{
    // for example we got something like this:
    Boolean CanPost { get; }
    Boolean CanEdit { get; }
    Boolean CanFlag { get; }

    void AssignRole(IUserRole role, User user);
}

public sealed class AdministratorRole : IUserRole
{
    public Boolean CanPost { get { return true; } }
    public Boolean CanEdit { get { return true; } }
    public Boolean CanFlag { get { return true; } }

    public void AssignRole(IUserRole role, User user)
    {
        user.Role = role;
    }
}
public sealed class NewMemberRole : IUserRole
{
    public Boolean CanPost { get { return true; } }
    public Boolean CanEdit { get { return false; } }
    public Boolean CanFlag { get { return false; } }

    public void AssignRole(IUserRole role, User user)
    {
        throw new NotSupportedException("text");
    }

}

public class User // : Entity<User>
{
    private IUserRole role;
    public class User(String name, String pwd, IUserRole role)
    {
        // ...
        this.role = role;
    }

    public Boolean CanPost { get { return this.role.CanPost; } }
    public Boolean CanEdit { get { return this.role.CanEdit; } }
    public Boolean CanFlag { get { return this.role.CanFlag; } }

    public void AssignRole(IUserRole role, User)
    {
        this.role.AssignRole(role, user);
    }

    public String Name { get; set; }
    public String Password { get; set; }
}     

On that step I’ve been considering to include User into domain model then to use it thru NHibernate DAL/DAO.

I’ve read about MembershipUser and MembershipProvider. And all authentification stuff is implemented in standard ASP.NET MVC template.

So if I use standard membership/membership-user where will the domain logic go? Should I then restrict operation over Post entity thru setting Authorize attribute on actions .. so they will work as permissions?

  • 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-29T03:40:03+00:00Added an answer on May 29, 2026 at 3:40 am

    Yes, in ASP.NET MVC applications, you have the ability to authorize/deny some users/roles on actions.
    It works with the membership provider defined in the project.

    .NET is shipped by default with 2 membership providers: one for sqlserver, with some scripts to run, and another one based on ActiveDirectory membership.

    You can also make your own Membership and Role providers. This way you’ll have the membership provider customized for your domain objects/behavior.

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

Sidebar

Related Questions

Ok, a few things I'm not quite sure about. For starters: I have a
I'm not too quite sure about what i should do about a grouped set
I'm not quite sure if it's possible to do what I'm about to ask
Ok, I'm not quite sure how to go about this. Here's the scenario. 1)
I'm not quite sure if this is possible, or falls into the category of
I have a problem that is common, but I am not quite sure exactly
Not quite sure how to troubleshoot this. I'm maintaining an ASP site, its mostly
Not quite sure how to word this question. I am wondering if there is
I'm not quite sure where to go with this. The overall objective is to
I'm not quite sure if this is specific to Sun Java Systems Application Server

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.