User Data in Orchard - orchardcms

is there any flag that determine if a user is active or not in orchard?
Because I tried to delete a user in orchard but the record is still exists in tables:
xxx_Orchard_Users_UserPartRecord
xxx_Orchard_Framework_ContentItemRecord
So I'm guessing there's another table that stores this info?
Thanks

Users are content types and Orchard creates content items for each user. When you create a new user Orchard adds records to xxx_Orchard_Users_UserPartRecord, xxx_Orchard_Framework_ContentItemRecord, xxx_Orchard_Framework_ContentItemVersionRecord and xxx_Orchard_Roles_UserRolesPartRecord if you linked any roles to the user.
The xxx_Orchard_Framework_ContentItemVersionRecord table keeps track of the version number and whether or not a content item is published or not and which version of the published content item is the latest.
When you delete the user Orchard does not delete the records from the tables, but simply creates a new version record and sets Published and Latest columns to 0 for the new version and the old version. Because there is no published and latest version the content item does not show up on the list of users.

Related

SharePoint document library not showing actual user's name in 'Modified By' on Custom List's meta-data

I have created an utility for browsing and uploading file from user's machine (OS is Windows10) to a SharePoint site's document library. This utility is created using 1. a canvas form created in Power App, 2. a workflow created in Power Automate and 3. destination document library of SharePoint site.
To briefly summarize about its working; when any user uploads any file using this form, workflow is triggered to store this file as an entry to a SharePoint list, and it is then sent to designated reviewers to get it reviewed and approved. On approval, file is moved from SharePoint list to another site's document library.
Files are successfully being moved to the destination document library.
Here is the problem I'm facing for the moved files - The document library has 'modified by' meta-data column associated with files. This field does not display actual user's name whoever uploads a file or replaces an existing file by uploading a modified version of this file. It always shows my name in 'Modified By' field.
Is there any way to fix this and show the actual user's name in this field who uploads any new file or replaces any existing one.
Any help is really appreciated.
Thank you.
The issue you are having is by design.
The kind of trigger you are using in SharePoint connector always operate in context of the owner of the flow (you)
Please check the following for detailed description and possible workarounds: https://sharepoint.stackexchange.com/questions/269396/microsoft-flow-always-run-in-context-of-user-who-published-it
You can try using 'update file properties'. I have not tested if this works or not, but it seems practical solution to test.

Programatically delete a user in Orchard

I am not an Orchard guru. I am a desktop apps guy with a lot of responsibilities that inherited a big blob of Orchard code and have been tasked with a few maintenance tools. I have tried googling the interwebs to no avail, so I am turning to Stack in a desperate attempt that someone has the easy button...
Basically (and this is an over-simplified use case) - we frequently have users that signup with a mistyped email address or forget their account information within a day or signup again but fat finger the password and then signup a third time, etc...
I have a maintenance console that allows an administrator to 'locate' data (in our own non-orchard sql tables) associated with the first or second accounts (in my example) and re-associate that data with the third 'current/correct' account.
At the conclusion of this re-mapping, I would like to programmatically clean-up (read: delete) the Orchard logins for the first two accounts which are now officially kruft.
I found some information on Stack here that talks about Orchard user accounts:
Users are content types and Orchard creates content items for each
user. When you create a new user Orchard adds records to
xxx_Orchard_Users_UserPartRecord,
xxx_Orchard_Framework_ContentItemRecord,
xxx_Orchard_Framework_ContentItemVersionRecord and
xxx_Orchard_Roles_UserRolesPartRecord if you linked any roles to the
user.
The xxx_Orchard_Framework_ContentItemVersionRecord table keeps track
of the version number and whether or not a content item is published
or not and which version of the published content item is the latest.
When you delete the user Orchard does not delete the records from the
tables, but simply creates a new version record and sets Published and
Latest columns to 0 for the new version and the old version. Because
there is no published and latest version the content item does not
show up on the list of users.
I understand this conceptually, but I can't believe to delete a user that I would be required to delete the records from each of these 'private' tables in orchard. Instead, I expect there is a class/method/technique for deleting the Content Type or Part or Record or whatever (I'm still haven't quite got Orchard object naming straight in my head).
Can anyone share an example of deleting a user in code (by Id or Username or Email)? Or point me at the relevant documentation? I'm fumbling around like a fish outta water here...
As always, thanks in advance!
So as you say, within Orchard most deletes from the UI are soft deletes, keeping all the data and setting a flag in the database to say this guy is deleted. To do this programmatically, where _contentManager is an instance of IContentManager.
var userItem = _contentManager.Get<IUser>(userId);
_contentManager.Remove(userItem);
To do a hard delete, which will delete the item record, all item version records and all content part records (titlepart, userpart etc.)
var userItem = _contentManager.Get<IUser>(userId);
_contentManager.Destroy(userItem);
This was added to orchard in version 1.9.

Can't find manually added records using the search box?

I'm migrating a webapp using jhipster so I already have a database with a lot of records that have to be in the new application.
Once I created the entity I added the records from my old database using:
INSERT INTO <table> SELECT * FROM <old-database>.<table>;
When I execute the webapp and search for a record in the entity view it doesn't show any old records (only the ones added using the Add button in the webapp).
I'm using MySQL for dev and prod, and I selected ElasticSearch when I was generating the app. The entity view shows the table with all the old records, but when I search for one using the search box it doesn't find them.
What am I doing wrong? Is that the correct way to insert the data?
using JHipster together with elasticsearch assumes, your app is fully aware of managing its search index. While inserting data on your own, your search index becomes inconsistent to your database, what is obvious.
In your case I suggest to install the JHipster elasticsearch reindexer module, which enables you to reindex the search index at any time you want. After reindexing, your old data should also appear in your JHipster application

SharePoint 2010 v4.master inheritance

I made a change to my v4 master at the application level to hide a certain piece of HTML code (the developer dashboard to be specific). I assumed I could edit it at the application level and then all site collections created within that application would inherit the changed v4 master and hide the element.
This is not the case though... in addition, I tried to edit the master in 14\TEMPLATES\LAYOUTS with no success either.
The only thing I have gotten to work is editing the v4 in SP designer at the site level (which is unaccepable to me as I want to provision a new site collection and not have to manually change this every time).
Any suggestions / known fixes for the issue I am encountering?
Try to hide what do you want thru style sheet CSS or don't update the default v4 mater page not recommended, create a new copy of V4 and do you updates then create Staplers features and on every site collection created change it's master page to the new one yo have created and for the old created site collection run thru code and activate the Staplee feature on each site collection to do the same.

how do i add a view to schema.xml in sharepoint

I am trying to add a view to a custom list. The target is MOSS 2007, I am using VS2008 w/ VSeWSS 1.3. The feature already has a custom list definition, including a custom view called "Calendar". To get started I thought I'd create another view called NewCalendar that is simply a duplicate of the existing custom view Calendar.
So, I copied Calendar.aspx to NewCalendar.aspx, copied the existing "View" node for the current calendar and pasted a new node, then changed the following attributes of the new node: DisplayName, Url, and DefaultView.
When I refresh WSP View NewCalendar.aspx shows up. When I deploy and go to NewCalendar.aspx i get a 404. Using SharePoint Manager I confirm the page is not present.
How do I add a custom view via a feature so that it shows up in the "View" drop-down?
UPDATE: It works if I create a new instance of my custom list. How do I get the custom view to show up on existing lists?
Unfortunately features in general are not retroactive. You cannot update a feature and expect all existing items that were created from that feature to be updated. This i assume is by design. If this were possible it could potentially have far reaching (unexpected) consequences.
In these senario's i script out a retrofit script, when publishing the new feature.

Resources