Web application breaks when user added to role - javascript

Using Identity 2.0 with a Web Forms project.
I can login successfully, and control access to pages using <allow users="<emailaddress>"/>, but when I add a user to a role in AspNetUserRoles, it causes the application to return this error:
The specified cast from a materialized 'system.int32' type to the 'system.string' type is not valid
The string of code that Visual Studio references on the crash is:
var user = manager.FindByName(Email.Text)
How can I fix this?

Discovered the problem. Our DB editor had changed the AspNetRoles table so that the RoleID field would auto-increment, and in doing so, the field changed from an NVARCHAR(256) to an INT. Changed it back and the problems has been resolved.

Related

Unable to fetch user data by using tiktok-scraper npm package

I have used tiktok-scraper for getting any public TikTok users data. It was working fine recently and I was able to get the required data but suddenly it stopped working and started giving this error:
Error: Can't extract user metadata from the HTML page. Make sure that the user does exist and try to use proxy
The module that I have used is .getUserProfileInfo('USERNAME', options) without using any options. Earlier I was able to get user details by just passing the username.
Someone has suggested to try using the cookie "sessionid_ss" in the sessionList option but I don't know where can I get this value from.
It would be great if someone can guide in this regard to get any public TikTok users' details based on the username.

Error (EvaluationException) on executing setSelectionFormula in XPage - Javascript code

When using XPages in Lotus Domino Designer, I encounter the following error (displayed in log file) on trying to set the view formula dynamically.
com.ibm.xsp.exception.EvaluationExceptionEx: Error while executing JavaScript computed expression
The following code fails ...
var helpview:NotesView = db.getView(viewNm);
var strQS:string= sessionScope.searchKey;
helpview.setSelectionFormula(strQS);
Error takes place at the setSelectionFormula line. strQS is the string for view selection formula.
This message just means there's an error in your code. Error handling will identify more details of why. Something like XPages OpenLog Logger (which is also incorporated into OpenNTF Domino API, if you also want that) will identify the cause. XPages OpenLog Logger captures the cause regardless of whether or not there is specific error handling on that block, providing a custom error page is added to the application.
The most probable cause, though, is that the user the database is being retrieved under does not have at least Designer access to the database, either in the ACL or Maximum Internet Access on the Advanced tab of the ACL.

SugarCRM Enterprise 6.5 - "app is not defined"

I'm trying to dynamically display a button in the detail view of a given record, depending on its record and the role of the current user. In order to do so, I'm including a custom javascript file in a detail view definition file, in custom/modules/Tasks/metadata/hide.js.
I need to access to the roles of a user, so first I'm trying to access to the user object. However, this fails:
var user = app.data.createBean('Users', {id: app.user.id});
It throws the following error: ReferenceError: app is not defined.
What's the right way to get the user (and then the role) through javascript in SugarCRM Enterprise 6.5?
The code you are using will work only with sugarcrm 7 or later versions.
App variable is not available in sugar 6.5.
You need to write custom api to get user roles.
In php you can get roles like this
global $current_user;
include_once('modules/ACLRoles/ACLRole.php');
$roles = getUserRoleNames($current_user->id);
print_r($roles);

Implement Tag Cloud and Unique Name Validation in umbraco 7.2.5

I am developing web application in Umbraco 7.2.5 and MVC. Can you please help me on implementing the below requirements inside umbraco.
Implementing Tag Cloud inside umbraco by adding as a datatype
Category Name - Unique Validation
Regarding second point, my requirement is if admin enters the existing Category Name and tries to publish he should get a validation message and publish shouldn't happen.I think Unique Validation is not available by default in Umbraco 7.
If the entered Category name is already available Umbraco Appends
(1) to it like Samsung and Samsung (1). After analysis I found a way but I am facing some issue in that too. Can you please help.
Validating the name in the Before Save Event. The problem with this approach is umbraco displays some generic message "Publish was cancelled by a third-party plugin" , which Admin won’t understand the exact reason. I tried customizing but couldn’t succeed. Is there any way I could customize the message. Below is the code i tried. Is there any event in javascript to fire when Publishing is performed.
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) {
ContentService.Saving += ValidateName;
}
private void ValidateName(IContentService sender, Umbraco.Core.Events.SaveEventArgs e) {.....
if (nameAlreadyExists) {
e.Cancel = true;
e.Cancel = true;
BasePage.Current.ClientTools.ShowSpeechBubble(BasePage.speechBubbleIcon.error, "error", "Already Exists");
}
}
The BasePage.Current.ClientTools stuff doesn't work in the Angular bits of v7, as that's for the ASP.Net MasterPages stuff. As far as I know, there is currently no server side way of emitting popup messages (although I now it's scheduled for release soon). According the issue for this on the issue tracker, it's due in 7.3! See issue comments here

Log In with PayPal button JavaScript code builder validation error

Sorry for the basic questions but as a very first step I'm just trying to test the "Log In with PayPal button JavaScript code builder".
I've created an app, gone to this button builder, set the return URL to my localhost and then as that failed to a public website (http://bbc.com) making the same settings on my app details page but whatever I do when clicking the button I get the following error:
"Relying Party Validation error: redirect_uri provided in the request does not match with the registered redirect_uri. Please check the request."
I've tried setting the button up for sandbox and production but both fail.
Has anyone had the same issue? I'm guessing I'm doing something really stupid. I'm just taking the "Dynamically generated JavaScript" code and adding it to an empty webpage.
Thanks.
Turns out it takes a while (a few hours) for the PayPal API to update to changes in the admin console. Changes were reflected after several hours, very unhelpful for testing. That was using the production option. Even when return_uri was being recognised as correct the scope settings were invalid despite selecting all the correct options.

Categories

Resources