EPrints Technical Mailing List Archive

Message: #06554


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] currrent_user => usertype


OK, then you’ll want something in the template.  That’s actually really simple, but needs a developer.  Create a plugin with the correct restrictions and have it appear in the toolbar.  It would look something like this:

 

 

package EPrints::Plugin::Screen::MagicLink;

 

use EPrints::Plugin::Screen;

@ISA = qw( EPrints::Plugin::Screen );

 

sub new

{

                my( $class, %params ) = @_;

 

                my $self = $class->SUPER::new(%params);

 

                $self->{appears} = [

                {

                                place => "key_tools",

                                position => 155,

                }

                ];

 

                return $self;

}

 

sub can_be_viewed

{

                my( $self ) = @_;

 

                return $self->allow( "magic_link" );

}

 

sub render

{

                my ($self) = @_;

 

                return $self->html_phrase(‘page_content’);

}

 

 

 

…put the file in the <eprints_root>/archives/<archive_id>/lib/plugins/EPrints/Plugin/Screen/ directory.

 

Then create a file in your cfg.d directory called something like z_magic_link.pl, containing:

 

$c->{plugins}{'Screen::MagicLink”}{params}{disable} = 0;

push @{$c->{user_roles}->{admin}}, "+magic_link";

push @{$c->{user_roles}->{editor}}, "+magic_link";

 

If that all works, you’ll see the link to the page and the content of the page displaying missing phrase error messages.  You can find the names of the phrases you want from that.  They need to be created.

 

Note that I copied some of this from a similar piece of functionality then typed some stuff into the email.  This is unlikely to compile.

 

 

--

Adam

 

From: <eprints-tech-bounces@ecs.soton.ac.uk> on behalf of "Stenger, Avischai" <avischai.stenger@ulb.tu-darmstadt.de>
Reply-To: <eprints-tech@ecs.soton.ac.uk>
Date: Thursday, 1 June 2017 16:04
To: "eprints-tech@ecs.soton.ac.uk" <eprints-tech@ecs.soton.ac.uk>
Subject: Re: [EP-tech] currrent_user => usertype

 

Hi Adam,

it should be shown on all pages for the logged user (as long as he is „admin“ or „editor“ ) 

Am 01.06.2017 um 16:54 schrieb Adam Field <adam@adamfield.net>:

 

Hi Avi

 

                Which page will this be appearing on?

 

--

Adam

 

 

From: <eprints-tech-bounces@ecs.soton.ac.uk> on behalf of "Stenger, Avischai" <avischai.stenger@ulb.tu-darmstadt.de>
Reply-To: <eprints-tech@ecs.soton.ac.uk>
Date: Thursday, 1 June 2017 15:48
To: "eprints-tech@ecs.soton.ac.uk" <eprints-tech@ecs.soton.ac.uk>
Subject: Re: [EP-tech] currrent_user => usertype

 

Hi Adam, 

 

 

i what to show a button only for usertype „admin" or „editor". all other user shouldn’t see it.

 

Avi

 

 

Am 01.06.2017 um 16:37 schrieb Adam Field <adam@adamfield.net>:

 

Hi Avi

 

                I don’t think so.  What’s your use-case?

 

--

Adam

 

From: <eprints-tech-bounces@ecs.soton.ac.uk> on behalf of "Stenger, Avischai" <avischai.stenger@ulb.tu-darmstadt.de>
Reply-To: <eprints-tech@ecs.soton.ac.uk>
Date: Thursday, 1 June 2017 15:30
To: "eprints-tech@ecs.soton.ac.uk" <eprints-tech@ecs.soton.ac.uk>
Subject: [EP-tech] currrent_user => usertype

 

Hi all,

 

 

is there a way to find out the „usertype“ of the current session in a static-page (lile lang/de/testfile.xpage ) or in a phrases-file (lang/en/zz_webcfg.xml) ?

 

 

 

Tnks

 

 

Avi

 

*** EPrints community wiki: http://wiki.eprints.org/

*** EPrints developers Forum: http://forum.eprints.org/

 

 

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech *** Archive: http://www.eprints.org/tech.php/ *** EPrints community wiki: http://wiki.eprints.org/ *** EPrints developers Forum: http://forum.eprints.org/

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: 
http://www.eprints.org/tech.php/
*** EPrints community wiki: 
http://wiki.eprints.org/
*** EPrints developers Forum: 
http://forum.eprints.org/

 

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech *** Archive: http://www.eprints.org/tech.php/ *** EPrints community wiki: http://wiki.eprints.org/ *** EPrints developers Forum: http://forum.eprints.org/