Delete accounts with Razor Web Pages - razor

So, I'm working through a basic membership management admin panel but I can't quite figure out how to delete a user account. I can create one easily enough with the WebSecurity class, but this class doesn't appear to have any functions to delete an account.
What exactly do i have to do to get this functionality?
Edit: If you are using ASP.NET Web Pages 2 you are now able to accomplish the above by calling the DeleteUser() and DeleteAccount() functions available in WebMatrix.WebData.SimpleMembershipProvider. If you are using ASP.NET Web Pages 1 the answer is still valid. Refer to the SimpleMembershipProvider Class MSDN documenation for more information.

You will have to write your own code to delete the account. It's simply an entry in your database, so use the Database helper to remove the relevant rows from the webpages_UserInRoles,webpages_Membership and UserProfile tables.

The checkmarked answer is incorrect. Use
Membership.DeleteUser()

Related

Not able to get value from custom table in PowerApps portal

I had created a custom table(entity) in dataverse of power app portal and added some dummy data. Table name is "TestTable" and created a column "TestColumn". I am trying to get data from this in powerapps portal using liquid query.
{{entities.cr3c9_testtable['ef5398fe-c68f-eb11-b1ac-000d3af25ac1'].cr3c9_testcolumn}}
I am able to get value in portal studio as shown below.
However, when I browse this site, it's not showing.
I tried to clear cache multiple times but having same result.
Please let me know if anyone has idea on this.
Thanks in advance.
Check if table/column name is correct. Since the column is named Test Column it should be something like cr3c9_TestColumn.
Also check if you have entity permissions for cr3c9_testtable with read access and assign appropriate web roles to that permission.

Angular 4 Dynamically Create Component from User Definable input

I'm looking to build an App in Angular 4 that would allow components to be dynamically created from storage (database, url, server stored file). The goal is to allow users to build there own components to create custom dashboards to view data.
I've been looking through google and stackoverflow to see if something like this has been achieved, but I have not seen anything to point me in the right direction.
If this is possible would anyone be willing to explain or link me to a resource to help me get started on this?
Thank you in advance
You can check these out:
https://medium.com/front-end-hacking/dynamically-add-components-to-the-dom-with-angular-71b0cb535286
https://angular.io/guide/dynamic-component-loader
I prefer number 1 because it provides a very detailed & clear guide.

How to add manage temparory data in DotnetNuke?

I am beginner in DNN. I am creating a module which provides Login, Dashboard and Add-Update Form. I have data in JSON format. I want to store it temparory while user use the website. Data will be destroy as soon as user will close the website.
Currently I have created a folder in my Solution Explorer of project in Visual Basic and created 3 .json files which stores login_info.json, basic_info.json and auth_info.json. I write json data whenever user login and I make it blank when user logout.
Above method is working fine now but I afraid it will work when I will publish this module.
Also I may have situation where I need to store image some where. I don't know how I will manage.
Can anybody please guide me?
Is this proper way to store data temparory in DNN?
Is there any other better way?
After getting one of reply for Database Suggestion
Is there any table which same as User Meta in DotnetNuke?
You use the ConnectionString that is used by DNN and access the database as you would normally.
DotNetNuke.Common.Utilities.Config.GetConnectionString()
Or you can use the Data Access Layer that the DNN Framework supplies. For that take the Christoc Templates. In there is all you need to communicate with the DB.

Yii2 Rbac not able to add new roles

In my Yii2 project previously I had worked on rbac, set it up as in the yii2 doc click here. Now I worked on different modules and I am back on rbac. Initially set it up with just sysadmin and staff. Now I want to add a new role along with the two previous roles. Which I did it auth_item table and assigned the user_id in the auth_assignmnet table to the new role created.
In my controller added the role name for which actions he can access. But still throws Forbidden Exception. Tried different things but unable to work on it..
Any solution for this?
First of all, you should modify RBAC structure using the provided authManager methods.
After adding new RBAC items manually in database or files you need to make sure cache is not keeping the old data.
Flush cache manually or call console method like
yii cache/flush-all

SonataAdminBundle and ACL Class-scope Permissions

Sorry for my english...
In my project I use ACL with SonataAdminBundle, but I can not understand why they did so, you need to have to create a record in the database, even when I want to use only Class-scope without Object-scope.
Also, when you create, for example, comments, SonataAdminBundle automatically creates an entry in acl_object_identities, it clutters up this action database.
I created a role that has the right to full access to all records in a table, regardless of who created the records, but SonataAdminBundle only displays them and prohibits editing.
The documentation for SonataAdminBundle reads:
because the object ACL permission is checked, the ACL for the object
must have been created, otherwise the AclVoter will deny EDIT access
for a non super admin user trying to edit another non super admin
user. This is automatically done when the object is created using the
Admin. If objects are also created outside the Admin, have a look at
the createSecurityObject method in the AclSecurityHandler.
But why? How to avoid this?
Do not want to write hooks.
Thank you in advance for any comments and help on this.
You can generate the object ACLs with php app/console sonata:admin:generate-object-acl