'Custom Personal Menu'

@classmethod
def menu_personal(cls):

    auth = current.auth
    s3 = current.response.s3
    settings = current.deployment_settings
    if (not auth.is_logged_in()):
        request = current.request
        login_next = URL(args=request.args, vars=request.vars)
        if ((request.controller == 'default') and (request.function == 'user') and ('_next' in request.get_vars)):
            login_next = request.get_vars['_next']
        self_registration = settings.get_security_self_registration()
        menu_personal = MP()(MP('Register', c='default', f='user', m='register', check=self_registration), MP('Login', c='default', f='user', m='login', vars=dict(_next=login_next)), MP('Lost    Password', c='default', f='user', m='retrieve_password'))
    else:
        has_role = auth.s3_has_role
        is_org_admin = (lambda i: (has_role('ORG_ADMIN') and (not has_role('ADMIN'))))
        menu_personal = MP()(MP('Administration', c='admin', f='index', check=has_role('ADMIN')), MP('Administration', c='admin', f='user', check=is_org_admin), MP('Profile', c='hrm', f='person', args=[str(auth.s3_logged_in_person())], vars={'profile': 1}), MP('Change    Password', c='default', f='user', m='change_password'), MP('Logout', c='default', f='user', m='logout'))
    return menu_personal
