Has anyone Written Code to Check In Other Admin's Webparts and Templates?

kentico guy asked on February 11, 2021 21:57

Kentico 12.0.15 Portal engine:

There's an issue in kentico where admins can't 'check in' stuff that's already checked out by another admin. Has anyone written any code to do this who could give me a high level on how this is done? Is there something in the Kentico API that allows a page to be "checked in" ?? I don't know why this functionality was not included in the stock kentico package. I can't be the only person who has to go to other admins (often decomm'd no longer at my company) and jump through hoops to get stuff "checked in."

Basically what I'm looking to do is just add a third button saying "check in for {X user}" and it just checks the item back in for it's current state. Or is there a way to do this out of the box through a setting?

Any pointers on this would be helpful to speed up the development of such a feature. I'll try to post whatever I find on here aswell.

Recent Answers


Juraj Ondrus answered on February 12, 2021 06:02

Global admin user can undo checkout for any other users. I would not recommend checking-in for someone else in general - what is the work is done only half way? It could break something.
It depends for what object you want to add the button. E.g. for pages you can use this API. For other objects, you would need to get given object using the infor provider (Get-someobject-Info), change the properties, e.g. the CheckedOutByUserID property and then update and set the oject's info.
Or, as an global admin you can impersonate given user.

0 votesVote for this answer Mark as a Correct answer

kentico guy answered on February 12, 2021 13:36

Juraj, the undo checkout option is not good. If another admin has made changes to the template and I "undo checkout" it breaks stuff. I need a way to just check in another admin's changes with all saves in-tact. Undoing checkout removes their changes and can break production. I want to be able to just check in an object as if the user with the checked out object "checked in" the template. Undoing changes won't cut it and you should have added this into the original app. Why would I want to "undo checkout" when I could just check in the existing object "as is"???

What I'm looking for is guidance on how to check in another admin's object and we also want to display when the object was last modified, checked out. What page .aspx/ascx do I need to modify and what API commands do I need to run? I'm not looking for excuses or reasons that this isn't preferable. I'm looking for the .ascx file to be modified and the API commands I'd need to implement to get this done. Please advise on:

1.) the ascx file to modify where I can add a button "check in for user {% UserWhoCheckedOutTheObject %}"

2.) the API commands I need to run in order to check in any object checked out by another user

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on February 12, 2021 13:47

I see your point - so in this case do not use the exclusive access - check in/out feature for the objects if it causes this issue. Because in general I can also say what if you check in someone's changes in the middle of the work?
The options you have is either impersonate the other user (with lower privilege level) or, as mentioned in my first post, get given objects info using the API, change the checked out by user property, check it in and save tje object's info. There is no universal method to check in any kind of object. For the admin UI - again this depends. Some UI pages are using ASPX files and ASCX controls but many parts were redesinged using Portal engine UI templates and UI elements which means you will need to edit also the UI web parts and controls.

0 votesVote for this answer Mark as a Correct answer

kentico guy answered on February 12, 2021 23:18

Juraj, I've already looked at the documentation. Please just ask the senior devs which ascx file has the "check in" "check out" buttons. I already found the commands I need to run. Get me the ascx file that has "check in" "check out" and I'll post my code after I implement it.

thank you good sir... we pay you a lot of money for your app. It should take you 15 minutes to get me the ascx file I need to modify. btw... tell your homies that Kentico is an awesome app

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on February 15, 2021 05:44 (last edited on February 15, 2021 05:45)

Hello, If you refer to my previous post I explained that not all UI pages are using physical files and there are also UI page templates and UI elements. You have not described for what object types you want this feature and I am sorry I am unable to list all the controls and files for every possible object type. You can inspect the frame of the UI page to see if it is using physial ASPX page and then you can investigate the underlaying controls used on that page or, if it is using UI element, check given UI page template in Page templates app to see what web parts are used and then check given web part's code files.

0 votesVote for this answer Mark as a Correct answer

L Younkins answered on April 6, 2021 17:04

I have a question about this as well. Is there a log or record to see when another Global Administrator has performed Undo Checkout for a page checked out? Our organization has several Global Administrators, so it would be helpful to have a record of when this has been done.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.