示例#1
0
        public ActionResult Index()
        {
            using (var ctx = new TPGPContext())
            {
                ctx.Roles.Count();
            }

            if (Session["username"] != null)
            {
                return(View("_AlreadyLoggedIn"));
            }

            return(View());
        }
示例#2
0
文件: RBACUser.cs 项目: chrisdns/TPGP
        private void GetUserRolePermissions()
        {
            using (TPGPContext ctx = new TPGPContext())
            {
                var user = ctx.Users.Where(u => u.Username == Username).FirstOrDefault();
                if (user != null)
                {
                    user.Role.Permissions = ctx.Roles.Where(r => r.Id == user.RoleId).SelectMany(r => r.Permissions).ToList();

                    Id   = user.Id;
                    Role = new UserRole {
                        Id = user.Role.Id, RoleName = user.Role.RoleName
                    };

                    user.Role.Permissions.ToList().ForEach(p => Role.Permissions.Add(new RolePermission
                    {
                        Id             = p.Id,
                        PermissionName = p.Name
                    }));

                    IsAdmin = user.Role.IsAdmin;
                }
            }
        }
示例#3
0
 public Repository(TPGPContext ctx)
 {
     dbContext = ctx;
     dbSet     = dbContext.Set <T>();
 }
示例#4
0
 public ScopeRepository(TPGPContext ctx) : base(ctx)
 {
 }
示例#5
0
 public ContractRepository(TPGPContext ctx) : base(ctx)
 {
 }
示例#6
0
 public UserRepository(TPGPContext ctx) : base(ctx)
 {
 }
示例#7
0
 public RoleRepository(TPGPContext ctx) : base(ctx)
 {
 }
示例#8
0
 public PermissionRepository(TPGPContext ctx) : base(ctx)
 {
 }
示例#9
0
 public PortfolioRepository(TPGPContext ctx) : base(ctx)
 {
 }
示例#10
0
 public GeographicalZoneRepository(TPGPContext ctx) : base(ctx)
 {
 }