Find out the user has access to this area - role [on hold]


DOOR3 James
25/12/2015 9:47 am
HOME ยป Programming Languages

I am in the process of building such that the user access to the different kinds of areas.

I must have sure me that, for example Admin part is for shared Admin.

It is for sure me that I can determine which users have access to the different area!

Helper.cs (Class)

public static class CheckList
{
    public static bool YouHaveAccessHere(int RankValue)
    {
       int brugeridValue =
Helper.BrugerInformation.SessionVale.SessionUserid();
       DataLinqDB db = new DataLinqDB();
       var UserValue = db.brugeres.FirstOrDefault(x => x.Id ==
brugeridValue && x.rank == RankValue);
       if (UserValue != null)
       {
           return true;
       }
       return false;
    }
}

AdminIndholdController.cs

[MvcApplication.SessionExpire]
public class AdminIndholdController : Controller
{

    // GET: AdminIndhold
    [HttpGet]
    public ActionResult Index()
    {
        //Here my class to check whether you have access to this page.
        if (CheckList.YouHaveAccessHere(1) == false)
        {
            return RedirectToAction("index", "account");
        }

        DataLinqDB db = new DataLinqDB();
        IndholdViewModel model = new IndholdViewModel();

        var forsideindhold = db.forsides.FirstOrDefault();
        model.IndholdText = forsideindhold.tekst;

        return View(model);
    }
}

As an extra little things, how can I do so if I have more numbers I entered ?. ( And possibly more numbers)

HelperClass.CheckList.YouHaveAccessHere(1, 2, 3)

Related to : Find out the user has access to this area - role [on hold]
Find out the user has access to this area - role [on hold]
25/12/2015 9:47 am by DOOR3 James in Programming Languages

I am in the process of building such that the user access to the different kinds of areas.

I must have sure me that, for example Admin part is for shared Admin.

It is for sure me that I can determine which users have access to the different area!

Helper.cs (Class)<


Role-based security: Access the role of current user
by rbonestell in Programming Languages
I have implemented role-based security within my ASP.Net application.
However, it seems the role is not passed to the authentication ticket I
create.
I want to use it to display/hide some content based on the users role. I
wrote this to do it:
if (HttpContext.Current.User.Id
In MVC3 how to restrict access to an Area with a role-based authorization?
by krs in Programming Languages

In MVC3 we can restrict access to a Controller using the [Authorize] attribute, specifying that the user must be in the Administrator role to access any controller action in the class, like in the following example...


[Authorize(Roles = "Administrator")]
public class MyDefault
Find out if current user is member of a role
by Kronvict in Programming Languages
Find out if current user is member of a role
 
I need a stored procedure to find out if the current user is a member of a certain role.
I want to pass the role name and return a bit to tell whether he is a member or not.
I have this code to list the groups the curr
Moodle how to find out the role of the logged in user
by chanley in Programming Languages

recently I am working with moodle in order to implement a context-aware block on it which could suggest the right quizes to its users based on their moods. What I need to know now is I need to know what is the role of the logged in user (it is a teacher, student, teacher assistant or admin). I ha


How can i give access to IIS_WPG user role in IIS
by Mario Tristan in Programming Languages

How can i give access to IIS_WPG user role in IIS.


I am trying to run .net 2.0 application on windows xp laptop


Object Design - User and Access Role in PHP with SQL
by 1sikbITCH in Programming Languages

how do you design your objects lets say you have an object user and an object access_role. The user is stored in users table in an sql database, the access_role knows the user_id and is stored in an sql database.


class user() {
protected $_name;
protected $_id
How to design database structure in mysql for user role assignment and area assignment?
by Switzerland in Programming Languages

Recently my company assign me a project that will mange my company marketing team.
I am in trouble or fail to decide about database structure.


In this project have Access Role that will be following:


1) CMO (Chief Marketing officer)


2) ------------Genera


Is it possible to restrict user/role access to TFS by file extension?
21/12/2014 10:20 am by RomanMtz in Programming Languages

My searches are turning up many useless results, so I am hoping someone here might know off hand. I would like to configure Team Foundation Server so that some members of a team (front end people) can only have write access on .cshtml, .css, .js files (etc) and the back-end developers can have w


What sql database role must a user have to use a MS Access project file
by tanminivan in Programming Languages

Today i tried changing a users role from db owner to db data reader and db data writer. This user uses an Access ADP file, to edit, add and delete records from a few tables in the SQL Server database. However, after doing so he got an OLE error from access on trying to open the ADP. Are there cer


Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2014 © bighow.org All Rights Reserved .