1

Hi,

I have to create a plugin to produce a report and it needs to be visible only for the Administrators.

I use this code to craete the link:

public CNavMenuLink[] AdminMenuLinks()
    {
        return new CNavMenuLink[] { new CNavMenuLink("MyPluginName", api.Url.PluginPageUrl()) };
    }

public PermissionLevel PageVisibility()
    {
        return PermissionLevel.Administrator;
    }

Why the Admin menu is visible for normal user with "MyPluginName" as only item?

Thanks.

flag

1 Answer

3

Try returning null if the current user isn't an admin.

if (!GetCurrentPerson().fAdministrator) return null;

PageVisibility() is only called when the user tries to visit your page.

The reason that an Admin menu link can show up for a non-site-admin is that some items show up for other admins (e.g. project-level admins).

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.