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

  • SEARCH
  • Home
  • 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 8156681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:01:59+00:00 2026-06-06T17:01:59+00:00

TO BE CLEAR: I have two groups of users – GroupA – User1, User2

  • 0

TO BE CLEAR:
I have two groups of users –
GroupA – User1, User2
GroupB – User3, User4
Group A does TaskA and creates TaskA Object
Group B does TaskB and creates TaskB Object
Role based prevents GroupA from editing TaskB Object and vice versa

The ISSUE – User1 can still edit User2’s TaskA Object

I have integrated SqlMembership into my custom database and in my custom tables I have a UserId field which maps to the GUID AspNet_UserId column in AspNet_User Table. A user can create a job, and it is associated with the user’s AspNet_UserId.

My issue is I have Role based security but I also must set security so only only User with UserId can access edit view that has model data containing his UserId.

I have looked at this post – ASP.NET MVC 3 using Authentication

(BUT the first part of the answer with 29 upvotes seems incomplete)

  • 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-06-06T17:02:01+00:00Added an answer on June 6, 2026 at 5:02 pm

    The Solution –

    I haven’t implemented this yet but from what I see this is what I am looking for. I found it here: http://forums.asp.net/t/1771733.aspx/1?Display+a+specific+data+for+User

    This will hopefully save me from having to look at WIF…

    (Keeping my fingers crossed)

    Employee Controller:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web.Mvc;
    using System.Web.Security;
    
    namespace UserDetails.Controllers
    {
    public class HomeController : Controller
    {
        private readonly List<Employee> m_employees;
    
        public HomeController()
        {
            m_employees = new List<Employee>
                              {
                                  new Employee
                                      {
                                          Id =  Guid.Parse("3aebbf53-3581-4822-bef4-c9701d927b93"),
                                          JobTitle = "Senior Developer",
                                          Manager = "Mr. Smith",
                                          Salary = 1500
                                      },
                                      
                                    new Employee
                                        {
                                            Id= Guid.Parse("{3924afa7-d31b-4d30-b368-f825d4028779}"),
                                            JobTitle = "Lead Developer",
                                            Manager= "Mr. Doe",
                                            Salary = 2500
                                        }
                              };
        }
    
        public ActionResult Index()
        {
            if (User.Identity.IsAuthenticated)
            {
                MembershipUser currentUser = Membership.GetUser(User.Identity.Name, true /* userIsOnline */);
                
                if (currentUser != null && currentUser.ProviderUserKey != null && currentUser.IsApproved)
                {
                    var currentUserId = (Guid)currentUser.ProviderUserKey;
    
                    Employee result = (from employee in m_employees
                                       where employee.Id == currentUserId
                                       select employee).FirstOrDefault();
    
                    return View(result);
                }
            }
    
            return View();
        }
    
        public ActionResult About()
        {
            return View();
        }
    }
    
    public class Employee
    {
        public Guid Id { get; set; }
        public string JobTitle { get; set; }
        public string Manager { get; set; }
        public int Salary { get; set; }
    }
    }
    

    Index View

    @{
        ViewBag.Title = "Home Page";
    }
    
    @model UserDetails.Controllers.Employee
           
    <p>
    
    @if (Model != null && User.Identity.IsAuthenticated)
    {
        <label>Your name is: </label>@User.Identity.Name <br/>
        <label>Your Job Title is: </label>@Model.JobTitle<br/>
        <label>Your Manager is: </label>@Model.Manager<br/>
        <label>And you earn way too less money: &euro;</label> @Model.Salary
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all i have to clear few things 1.This is not spam group
I have two tables, locations and location groups CREATE TABLE locations ( location_id INT
Suppose I have two tables: Group ( id integer primary key, someData1 text, someData2
Say we have two aggregate roots in a domain model: Group and User. Now,
I think the title is clear, but I will elaborate. I have two websites
I have two checkbox groups that I ultimately need to have one of them
I have basic idea on Kilo Virtual Machine on Mobiles , I have clear
I have a Clear button which sets the gridview datasource to null and binds
I have to clear and redraw a raphael javascript main container. I've tried with
Hi I have several text input boxes, and i have a clear button, they

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.