public ActionResult Edit(string id) { //1st step of wizard. Permission permission = _memberShipFactory.CreatePermissionDao().Get(id); return(View("Permission", permission)); }
/// <summary> /// </summary> /// <param name="currentUser"></param> /// <param name="resource"></param> /// <param name="operators"></param> /// <returns></returns> public bool HasRight(User currentUser, object resource, Enum operators) { if (resource == null) { throw new ArgumentNullException("resource"); } if (currentUser == null) { return(false); } if (Convert.ToInt32(operators) == 0) { return(false); } if (currentUser.LoginId == User.AdminLoginId) { return(true); } IPermissionDao permissionDao = _factory.CreatePermissionDao(); IList <Permission> permissions = permissionDao.GetUserPermissions(currentUser.LoginId, resource); return (permissions.Any(permission => permission.Resource.Equals(resource) && permission.HasOperator(operators))); }