goeh / grails-crm-core

CRM core plugin for the Grails Web Application Framework
Apache License 2.0
12 stars 7 forks source link

tenant UI for admin managememnt #6

Closed kmacpher67 closed 8 years ago

kmacpher67 commented 8 years ago

Is there a tenant UI for admin management? Whats the general practice on this? How do we assign users to a tenancy? Is this all groovy scripts or is there a admin UI is there a Tenant Service layer or just the TenantUtils?

crmSecurityService.runAs(admin.username) {
            def account = crmAccountService.createAccount([status: "active"])
            def tenant = crmSecurityService.createTenant(account, "GR8 Contacts", [locale: Locale.ENGLISH])
            crmSecurityService.runAs(admin.username, tenant.id) {
                crmSecurityService.addPermissionToUser("permission.all")

Does the user that creates a tenant does it "own" it by default? What happens if tenancy is created and nobody is assigned "permission.all" ? Ton more questions, but if there is a UI, then I'll investigate that. Otherwise, then I'll have to write one?

goeh commented 8 years ago

There is not yet an official user admin UI plugin. I have a private crm-security-ui plugin that I use in most of my customer projects. But it needs cleanup and docs before I can make it public. The plugin includes UI for managing tenants, users, roles and permissions.

kmacpher67 commented 8 years ago

Goeh: :8ball: any chance of this beta code being available as "unreleased?" Kewl, cause I figured it was me being stupid. So I started digging into the code what is this "parent" thing? Can tenants have sub-tenants? wow? mind blown, but that works for larger orgs that require franchisee access or sub-business models for a master to track the child tenants contacts, orders, items, etc.

def parent = params.remove('parent')
        if (parent) {
            if (parent instanceof Number) {
                parent = CrmTenant.load(parent)
            }
            if (!parent) {
                throw new IllegalArgumentException("Can't create tenant [$tenantName] because parent tenant [${params.parent}] does not exist")
            }
        }

        // Create new tenant.
        def tenant = new CrmTenant(account: account, name: tenantName, parent: parent, locale: params.remove('locale')?.toString())

The whole Tenant concept is wild. It's a container around the CRM container, your cross cutting implementation is awesome. I worked on a project where I was introduced to Grails, they folks were building / "built" a CRM system much like you have done as a consulting solution-product. The owner-main guy struggled with this. I suggested Open-Sourcing the code with the idea of building a stronger more sustainable product by using the community. Let me know about the UI plug-in, if nothing else, it would provide me a code snippet starting point, otherwise, I think the option is to just have a single instance per tenant or manually add tenants. that leaves the question of User Admin UI. Still stuck, That's a show stopper. Let me know. I'm stuck between vTiger PHP CRM and this. I really don't want to do PHP and I really don't want to write a User-security-UI let alone a plugin from scratch. I would be willing to seriously rape your existing plug-in as a fork. I doubt you'd want me hacking one a critical plugin like that.

kmacpher67 commented 8 years ago

continue on the thread of "Tenants" do you use "themes" to manage LOGO issues for the tenants.

       if(params['theme'] && !params[CrmThemeService.OPTION_THEME_NAME]) {
            params[CrmThemeService.OPTION_THEME_NAME] = params['theme']
            params.remove('theme')
        }

Can I customize the Logo Name in the corner via the UI http post by sending a theme name that corresponds to the new tenant? Does that mean that each tenant gets (requires) a custom theme? I got the sample m4-greach running git clone -b m4-greach https://github.com/gr8crm/gr8contact.git m4 I was going to hack the logo IMAGE in the corner, that's what started this addendum to the thread. * ANSWERED my last comment looking for more details for this one * http://gr8crm.github.io/plugins/crm-core/#crm-gr8-crm-has-multitenancy-built-in

goeh commented 8 years ago

The theme support in GR8 CRM makes it possible to have different logo images and also different stylesheets depending on the active tenant. The theme support is optional.

If no custom theme is defined the default theme will pick up logo image URL:s from Config.groovy: crm.theme.logo.small = "/images/company-logo-small.png" crm.theme.logo.medium = "/images/company-logo-medium.png" crm.theme.logo.large = "/images/company-logo-large.png"

goeh commented 8 years ago

Re: sub-tenants It works exactly as you guessed "franchisee access or sub-business models for a master to track the child tenants contacts, orders, items, etc.". I have multiple customers that use the same Grails application instance but each customer have their own logo and stylesheet. And each customer have multiple sub-accounts that have a tenant each. Think accounting services. The accounting service has it's logo and theme and they sell the service to their clients. The clients think it's a cloud service provided by the accounting company, but they are all running the same Grails application hosted in our datacenter. This is pretty advanced stuff, but it has been working very well for us. :)

goeh commented 8 years ago

Let me check the status of crm-security-ui. Maybe I can make the repository public. But I'm very busy right now. Please give me a couple of days to check.

kmacpher67 commented 8 years ago

thanks no problem