Edit User groups for Subcategory

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Edit User groups for Subcategory

Coleen_Astalos
Is there a way to give a user administrator rights to just a subcategory?  

What I'm wanting to do is give a person the right to add/remove people from the subcategory they are the moderator for.  I've been able to see that I can set it so they subscribe/unsubscribe people, but I also need the ability for them to be able to add the users to the Newsletter Co-op group (which is the group that is allowed to access that section).  However, I don't want to give the person overall administrator ability to add/remove people from all the groups - just the individual category (and subcategories of it).  

This is the Newsletter Co-op section that I had been using for my testing and I'm not getting set up for our Newsletter Co-op feature.  I've set up a new user group called "Coordinator with admin rights" and in the Newsletter Co-op section, I've set the permissions to be able to do everything that an Admin person can do.  But I'm not seeing the option for them to be able to edit (view/add/remove) who is in the Newsletter Co-op group.

Thanks,
Coleen
Reply | Threaded
Open this post in threaded view
|

Re: Edit User groups for Subcategory

Pedro
We can do the following approach:
1 - Create a group News_Admim
2 - Add an user in Administrator and in News_Admim
3 - At manage_users_and_groups macro we can create if tags to check which groups the user from News_Admim  would see at the Manage Users & Groups page.

What do you think?
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Edit User groups for Subcategory

Coleen_Astalos
Yes, that sounds like a good solution.  Let me know the changes I'd need to make to the manage_users_and_groups macro.
Thanks,
Coleen
Reply | Threaded
Open this post in threaded view
|

Re: Edit User groups for Subcategory

Pedro
Take a look at this code:
<override_macro name="manage_users_and_groups" requires="servlet">
    <n.if.not.visitor.can_manage_users_and_groups>
        <then>
            <n.login.><t>Only authorized users can proceed in this area.</t></n.login.>
        </then>
    </n.if.not.visitor.can_manage_users_and_groups>
    
    <n.if.is_submitted_form>
        <then.save_users_and_group/>
    </n.if.is_submitted_form>
    
    <n.html>
        <head>
            <META NAME="robots" CONTENT="noindex,nofollow"/>
            <n.title.><t>Manage Users & Groups</t></n.title.>
                <n.if.is_submitted_form>
                    <then>
                        <script type="text/javascript">
                            $(document).ready(function() {
                            notice('<t>Data successfully saved</t>', 2000, 1000);
                            });
                        </script>
                    </then>
                </n.if.is_submitted_form>
                </head>
                <body>
                    <n.edit_header first_text="[t]Manage Users & Groups[/t]" second_text="[n.root_node.subject/]" />
                    
                    <div class="weak-color" style="margin-top:1em">
                        <t>Below you can manage groups and users. You can copy and paste users in order
                            to move them from one group to another.</t>
                    </div>
                    
                    <div class="weak-color" style="margin:.5em 0 1em">
                        <t>You can also <n.root_node.change_permissions_link.>change the permissions</n.root_node.change_permissions_link.> of the groups below.</t>
                    </div>
                    
                    <n.user_groups.>
                        <n.add.members_group/>
                        <n.add.administrators_group/>
                        <n.sort/>
                        <n.vertical_tab_control.>
                            <n.add_new_group_vertical_tab/>
                            <n.if.visitor.is_in_group group="master" >
                                <then>
                                    <n.add_group_vertical_tab group="subForum"/>
                                </then>
                                <else>                                    
                                    <n.add_all_users_vertical_tab/>
                                    <n.add_registered_vertical_tab/>
                                    <n.loop.>
                                        <n.add_group_vertical_tab group="[n.current_group/]"/>
                                    </n.loop.>
                                </else>
                            </n.if.visitor.is_in_group>
                            <n.reset_list_index/>
                        </n.vertical_tab_control.>
                    </n.user_groups.>
                </body>
    </n.html>
</override_macro>
There are two new groups created "master" and "subForum", you can change these names later. You must keep at least one user in each group.
You have to add an "User A" in admin group and in master.  Even though  the "User A" is in both groups, he will only see subForum group.
Then, set the permissions for the subForum group at the sub app you want.

Let me know if you have any issues.
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Edit User groups for Subcategory

Coleen_Astalos
I set up a NewsAdmin group and put myself (coleen@gojade.org) into it as well as into the overall "Administrator" group.    The group I'm wanting this person to have access to is the Newsletter Co-op group - so I made those changes in the manage_users_and_groups_macro.

This change allows them only to see the "Newsletter Co-op" group when you select "Manage Users & Groups".  But there still are a lot of admin functions that the user can get to that I don't want, such as on that page:
- Changing the permissions of the groups themselves
- Adding new groups

Then the administrative features such as under the People Tab, selecting a user and...
- Adding/Removing the groups by checking the check boxes there (would want only the Newsletter Co-op group showed to this "News Admin"
- Banning a user (shouldn't be able to)
- Subscribing/Unsubscribing a user (shouldn't see at all)

Plus all the general administrative items under Options:
- Application
- Structure
- Users
- Embedded options,
- etc.

I definitely don't want them to have access to those items.  So adding them to the main Administrators group doesn't seem to be a viable option - too many places to go in and check if they're an administrator are they also in this NewsAdmin group.    

Would it be possible to just add the "manage_users_and_groups" to the pull-down options list for this NewsAdmin group?

Coleen
Reply | Threaded
Open this post in threaded view
|

Re: Edit User groups for Subcategory

Pedro
Of course, I do understand your point. I'll think in another way to do it.
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Edit User groups for Subcategory

Pedro
In reply to this post by Coleen_Astalos
Please, try this:
<override_macro name="menu_manage_users_and_groups" requires="node">
    <n.if.is_in_command name="dropdown">
        <then>
             dropdown.add('manageGroups', '<n.javascript_string_encode.manage_users_and_groups_link/>', 'display:none');
        </then>
        <else>
            <n.set_local_node.this_node/>
            <n.if.both condition1="[n.local_node.is_root/]" condition2="[n.visitor.can_manage_users_and_groups/]">
                <then>
                    NabbleDropdown.show('manageGroups');
                    <n.if.visitor.is_in_group group="master" >
                        <then>
                            $(document).ready(function() {
                            var group = $("#manageGroups a").attr("href");
                            $("#manageGroups a").attr("href",group+"&group=subForum");                         
                            });
                        </then>
                    </n.if.visitor.is_in_group>
                </then>
            </n.if.both>
        </else>
    </n.if.is_in_command>
</override_macro>

<override_macro name="can_manage_users_and_groups" requires="user">
        <n.either>
        <condition1.is_site_admin/>
        <condition2.is_in_group group="master" />
    </n.either>
</override_macro>

<override_macro name="manage_users_and_groups" requires="servlet">
    <n.if.not.visitor.can_manage_users_and_groups>
        <then>
            <n.login.><t>Only authorized users can proceed in this area.</t></n.login.>
        </then>
    </n.if.not.visitor.can_manage_users_and_groups>
    
    <n.if.is_submitted_form>
        <then.save_users_and_group/>
    </n.if.is_submitted_form>
    
    <n.html>
        <head>
            <META NAME="robots" CONTENT="noindex,nofollow"/>
            <n.title.><t>Manage Users & Groups</t></n.title.>
                <n.if.is_submitted_form>
                    <then>
                        <script type="text/javascript">
                            $(document).ready(function() {
                            notice('<t>Data successfully saved</t>', 2000, 1000);
                            });
                        </script>
                    </then>
                </n.if.is_submitted_form>
                </head>
                <body>
                    <n.edit_header first_text="[t]Manage Users & Groups[/t]" second_text="[n.root_node.subject/]" />
                    
                    <div class="weak-color" style="margin-top:1em">
                        <t>Below you can manage groups and users. You can copy and paste users in order
                            to move them from one group to another.</t>
                    </div>
                    
                    <div class="weak-color" style="margin:.5em 0 1em">
                        <t>You can also <n.root_node.change_permissions_link.>change the permissions</n.root_node.change_permissions_link.> of the groups below.</t>
                    </div>
                    
                    <n.user_groups.>
                        <n.add.members_group/>
                        <n.add.administrators_group/>
                        <n.sort/>
                        <n.vertical_tab_control.>                           
                            <n.if.visitor.is_in_group group="master" >
                                <then>
                                    <n.add_group_vertical_tab group="subForum"/>
                                </then>
                                <else>   
                                    <n.add_new_group_vertical_tab/>                                 
                                    <n.add_all_users_vertical_tab/>
                                    <n.add_registered_vertical_tab/>
                                    <n.loop.>
                                        <n.add_group_vertical_tab group="[n.current_group/]"/>
                                    </n.loop.>
                                </else>
                            </n.if.visitor.is_in_group>
                            <n.reset_list_index/>
                        </n.vertical_tab_control.>
                    </n.user_groups.>
                </body>
    </n.html>
</override_macro>
You can add the User only in "master" group. Take a look at the code and let me know if you want any explanation.
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Edit User groups for Subcategory

Coleen_Astalos
Yes, this seems to work great and just what I need.
Thanks,
Coleen