Register/ Login/ Membership module in Orchard - orchardcms

I can't figure out how to add Register/Login functionality to a site in Orchard. Is there a Membership module or some configuration I need to enable?
EDIT: What I had in mind were modules along the lines of these that extend the existing User model with registration/profile functionality:
Extended Registration module: http://extendedregistration.codeplex.com/
Orchard Profile module: http://orchardprofile.codeplex.com/

It's under settings/users in the admin ui.

In the Dashboard scroll down to Settings and select Users.
Make sure "Users can create new accounts on the site" is checked and click "Save".
Once this is done log out.
Then click log in, and bellow your username and password field there will be a small text with a blue link to Register.
You don't actually need the extended registration and profile for this. Those are for adding additional information to the registration form.
This can also be done programmatically:
var registrationSettings = _services.WorkContext.CurrentSite.As<RegistrationSettingsPart>();
registrationSettings.UsersCanRegister = true;
However this will not work if you're doing it from Migrations because you won't be able to use WorkContext.
For migrations you can use IRepository for RegistrationSettingsPartRecord:
RegistrationSettingsPartRecord currentSetting = _registrationSettingRepository.Table.First();
currentSetting.UsersCanRegister = true;
_registrationSettingRepository.Update(currentSetting);
However this will no longer work as of Orchard version 1.8 as the record no longer exists. As of 1.8 one way I know of would be using ISiteService:
var site = _siteService.GetSiteSettings();
var regsettings = site.As<RegistrationSettingsPart>();
regsettings.UsersCanRegister = true;

Related

How to disable all service integrations of one kind

I have added a slack service template to my gitlab-ce via the administrators interface. Everything worked. I activated "active by default".
As a result, all projects now push notifications into the main channel. And those are a lot.
Changing the service template configuration is not inherit by the projects. Thus effectively rendering me unable to revert the setting via the admin UI.
So, how can I disable the slack service integrations for all projects before it drives all of us crazy because the general-channel is just flooded by gitlab?
That is followed by issue 40921:
Allow to apply service template to all projects
Sometimes users want to apply the same integration like JIRA across all GitLab projects, currently templates are the only way to do that through the UI, but project integration templates only works for projects that have been created after it.
Only workaround:
I had this issue too. One workaround is to patch the database like this:
sudo gitlab-rails dbconsole
UPDATE services SET properties = replace(properties, 'http://someoldurl.com', 'https://somenewurl.com');
(to be adapted to your slack setting: this is just an example)
Following #VonC's advice to dive into the depths of psql and hack my way through, I finally ran following command to disable the active flag for the relevant services (slack and mattermost in our case):
sudo gitlab-rails dbconsole
UPDATE "services" SET active = FALSE WHERE type LIKE 'SlackService' AND active = TRUE;
UPDATE "services" SET active = FALSE WHERE type LIKE 'SlackSlashCommandsService' AND active = TRUE;
UPDATE "services" SET active = FALSE WHERE type LIKE 'MattermostService' AND active = TRUE;
UPDATE "services" SET active = FALSE WHERE type LIKE 'MattermostSlashCommandsService' AND active = TRUE;

How to create single page application in liferay 7?

Can anyone share some detailed info on how to create a Single Page Application (SPA) in Liferay 7 using SennaJS.
I could't found any documentation on How to create SPA in Liferay 7.
It comes by default, except if you unset the following property:
javascript.single.page.application.enabled=true
BTW, it is rather annoying in dev instances, as it takes a while to load pages in the first access, sometimes you even need to reload the page. Also, be aware, in some especial cases, some applications might break, normally due to code that counts with page reloads to function properly.
you can even create it in 6.2 by using the following code.
// initializing senna
var app = new senna.App();
// Set links selector for navigations
app.setLinkSelector(".senna-link");
// set basic path of liferay site
app.setBasePath('/web/spa-demo/');
// Id of DOM element which will be replaced from
// next page request
// using content div - default in liferay theme
app.addSurfaces('content');
// define routes for all the navigation links
// route link = Base path + page link
app.addRoutes([
new senna.Route('home', senna.HtmlScreen),
new senna.Route('second', senna.HtmlScreen),
new senna.Route('third', senna.HtmlScreen),
]);
Thing which you need to take care of, if it is SPA, then all the events need to be bound first i.e. delegate as there is not going to be page refresh.
i.e things like document.getReady is only going to be called once.
Whatever the portlet you are going to create and deploy with Liferay SDK/Workspace OR any compatible liferay plugin it will be SPA by default.
No need to do any coding on top of it.

How do I configure an existing website or create a new one in WiX?

I'm creating a wix installer to install multiple web applications, I give the user the option to select an existing website or create a new one. So far, I have implemented the user interface and queried the IIS for the existing websites, but the problem is that I don't know how to configure these two options. I tried using conditional components where I check for a property I set in a custom action but the issue with this scenario is that I end up placing the website element inside a component which I don't want to do in case the user chose an existing website(to avoid it from getting deleted on uninstall)..I found solutions on the web for installing to an existing website or creating a new one but never the both..Can anyone help me with this?
You can create Custom action for that and set the result of it to wix property.
string result ;
session["RESULT"] = result;
then in your wxs :
<Custom Action="InstallWebsite" After='InstallFinalize'>NOT Install AND (<![CDATA[RESULT<>"Existing"]]>)</Custom>
You can create Custom action for that and set the result of it to wix property.
string result ;
session["RESULT"] = result;
then in your wxs :

Cannot use SPWeb, database login failed

We have an archive site that is an exact copy of the "live" site, but uses a different service account. I have built an EditControlBlock extension that redirects a user to a page in the _layouts folder. The page has some text on it and an Ok button.
Edit: The SPWeb i am trying to use is in a different WebApplication. I am trying to move file x to the archive site.
When the Ok buttons is clicked, it should execute the following code:
using (var archive = new SPSite(archiveurl, SPContext.Current.Web.CurrentUser.UserToken))
{
using (var newsArchive = archive.RootWeb.Webs[SPContext.Current.Web.Name])
{
//move file
}
}
The weird thing is, it breaks on line 2: using (var newsArchive = archive.RootWeb.Webs[SPContext.Current.Web.Name]) Which is weird, because the first line DOES work.
The error I get is:
login failed for user x on database y
Anyone have an idea here? Is code on a page derived from LayoutsPageBase always run as the web app apppool account or something?
I have set the Database ights for the moment on the target database. I had to make the apppool user of the source web app a member of the db_owner group in the target database. Not to sure if this is the way to go. Anyone with a better idea please tell me.

WSS 3.0 Site Provisioning

Is there any way to do WSS 3.0 site provisioning? My client's requirement is attributes as variables that will be defined in XML format: Organization Name, Logo, Address, User and Role information. The client should be able to install this web application to any WSS production server by just defining the attributes in the XML file.
Is it possible to to write a utility to parse that well defined XML and provision the site accordingly?
It's possible to provision sites from the object model, but creating entirely customized sites is beyond the scope of a single question. To get you started, you should take a look at the SPWebCollection.Add as well as the SPSiteCollection.Add.
To create a site collection and some subsites into one of your web applications, you could use something like this:
var farm = SPFarm.Local;
var solution = farm.Solutions.GetValue<SPSolution>("YourSolution.wsp");
var application = solution.DeployedWebApplications.First();
var sites = application.Sites;
using(var site = sites.Add("/", "Root Site", "Description", 1033, "YOURTEMPLATE#1", "YOURDOMAIN\SiteCollectionAdmin", "Site Collection Admin", "admin#yourcompany.example")) {
using(var rootWeb = site.RootWeb) {
// Code customizing root site goes here
using (var subSite = rootWeb.Webs.Add("SubSite", "Sub Site", "Description", 1033, "YOURTEMPLATE#2", false, false)) {
// Code customizing sub site goes here
}
}
}
Yes, there are more than one.
Take a look at SharePoint Solution Generator which is in Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions.
You may create a site with all requirements of yours (pages, lists, document libraries...) and then generate a VS project that will create a SharePoint feature with all of your site. Then you may deploy that feature to any WSS production server.
You may alter the VS project to implement the logic to read your attributes from an additional xml file.
If the structure of your site is plain or you can save it as a template you may also write a small console application that reads the attribute xml file and create the site.
Create a regular solution, or use the aforementioned solution generator to generate the .wsp file. Then create a small console application, that expects the variables you mentioned as parameters.
With the code listed above, provision the new sitecollection from that solution, and store the entered parameters (Company name etc.) in the site in a list, or in the SPSite.Properties propertybag, from which you can then read them in custom webparts etc..
The SharePoint Data Population Tool available on CodePlex allows you to define sites with XML.

Resources