草庐IT

accounts_roles

全部标签

c# - MVC5 : UserManager. 添加到角色 () : "Error Adding User to Role: UserId not found"?

我一直在试验MVC5/EF6并尝试使用代码优先迁移进行新的身份验证。解决方案中的所有内容目前都在构建,我可以添加Migration,但是当我通过VS2013中的update-database执行packagemanagerconsole时,我的Configuration.cs文件无法将我的测试数据完全处理到我的表中并输出ErrorAddingUsertoRole:UserIdnotfound。我曾尝试明确设置一个用户ID并将其留给管理器生成(如某些示例所示),但每次我都收到相同的错误消息。我知道错误在我的#regionUser&UserRoles文件的Configuration.cs中

c# - 无效操作异常 : Cannot create a DbSet for 'Role' because this type is not included in the model for the context

以下解决方案适用于.netcore1.1,但从1.1升级到2.0后,我收到以下错误:InvalidOperationException:CannotcreateaDbSetfor'Role'becausethistypeisnotincludedinthemodelforthecontext.当用户尝试登录并执行以下语句时:varresult=await_signInManager.PasswordSignInAsync(model.Email,model.Password,model.RememberMe,lockoutOnFailure:false);怎么了?User.cspubl

c# - 如何修复 : The number of properties in the Dependent and Principal Roles in a relationship constraint must be identical?

我正在对SQLServer2012数据库使用EntityFramework4.3.1,并且我正在使用POCO方法。我收到以下错误,我想知道是否有人可以解释如何修复它:模型验证异常Oneormorevalidationerrorsweredetectedduringmodelgeneration:\tSystem.Data.Entity.Edm.EdmAssociationConstraint::ThenumberofpropertiesintheDependentandPrincipalRolesinarelationshipconstraintmustbeidentical.没有可用

c# - asp.net MVC3 Razor : display actionlink based on user role

我是MVC的新手。我希望能够为某些用户隐藏一些操作链接。假设我有一个“创建”操作链接,我只希望管理员看到并单击它。我想使用asp.net中可用的某种“loggedintemplate”,但它似乎在razor中不起作用。我可以使用某种带有if语句的代码块来检查当前用户及其角色,但这可能不是最佳做法?我的index.cshtml..//wantsomeadminauthattributehere...@Html.ActionLink("CreateNew","Create")我的Controller..//GET:/Speaker/Create[Authorize(Roles="Admin

google-app-engine - 谷歌应用引擎 - "Please use https://accounts.google.com/ServiceLogin instead."错误

我的GoogleAppEngineGo应用程序出现奇怪的错误。当我提示用户登录时,他们将被重定向到Google的登录屏幕。登录后,他们会收到一条消息Pleaseusehttps://accounts.google.com/ServiceLogininstead.我已经几个月没有碰过我的应用程序代码了,以前这不是问题。我的登录码基本就是theofficialdocumentation里面能看到的.我可以在Chrome和Firefox以及多个帐户中轻松重现此错误。app可以查看here(NSFW-ish),登录按钮在每个页面上。 最佳答案

php - Twig:如果 is_granted ('ROLE_MANAGER' ) 未授予检查

我想检查一个角色是否未被授予。我必须只为USER显示一些内容,但MANAGER是上面的层次结构。为了得到我正在做的事情:{%ifis_granted('ROLE_MANAGER')%}{%else%}mymessage{%endif%}这不是很好。什么是正确的语法:{%ifis_NOT_granted('ROLE_MANAGER')%}想法? 最佳答案 或者再来一次{%ifnotis_granted('ROLE_MANAGER')%}mymessage{%endif%} 关于php-Tw

android - 应用内购买 : get the name or ID of the Google Play account that's requesting a purchase

我想获取进行购买的用户的姓名/ID。如果可能,我想不使用AccountManager,因为它的使用需要额外的权限。即使使用AccountManager我也看不到确定当前帐户的方法,因此欢迎提供任何建议。 最佳答案 我认为这是不可能的。在联系Google支持之前,我尝试了所有可能的方法。我得到的回复是这样的:ThanksforcontactingGooglePlayDeveloperSupport.PleasenotethatGoogledoesnotprovideaccesstoanyconfidentialuserinformat

Android 应用在 addAccountExplicitly(account, password, null) 上崩溃;

基本身份验证成功后,我想添加一个帐户以供以后使用。当我尝试使用以下代码创建此帐户时:AccountManageraccountManager=AccountManager.get(getBaseContext());finalAccountbasicAccount=newAccount(mEmail,"com.example");accountManager.addAccountExplicitly(basicAccount,mPassword,null);当调用addAccountExplicitly(...)时,应用程序崩溃并出现以下错误:E/AndroidRuntime:FATA

android - 使用 GCM 时获得 GET_ACCOUNTS 权限 - 为什么需要这样做?

我有一个应用,实现了推送通知。我想了解在实现GCM时为什么需要“GET_ACCOUNTS”(android.permission.GET_ACCOUNTS)的原因?一些用户对此权限表示担忧。我已在list中使用此权限,因为它在官方网站here中给出.这个权限有多安全?如果我从list中删除它,推送通知会起作用吗? 最佳答案 ItusesanexistingconnectionforGoogleservices.Forpre-3.0devices,thisrequiresuserstosetuptheirGoogleaccounton

.net - Azure 上的 MongoDB : VM or Worker role?

我有兴趣在Azure上托管mongoDB。我相信对于在Azure上托管数据库的确切方式,我有几个选择:虚拟机或辅助角色。每个选项的优缺点是什么?更具体地说,每种方法在维护、配置、可扩展性、从.net使用的难易程度和成本方面有何不同。以后切换到其他选项容易吗?关于我正在创建的内容的一些细节(虽然我很想听听基于不同情况的选项的一般利弊):数据库将由Azure网站访问。这个网站将是一个ASP.netMVCWebAPI站点休息服务。我不希望服务以及数据库的流量超过每分钟100个资源请求,至少开始。该数据库将相对较小,在可预见的future将远低于10,000条记录。