Restrict available skins

Moderator: crythias

Locked
aph
Znuny superhero
Posts: 646
Joined: 20 Jun 2014, 12:11
Znuny Version: 3.3.9, 4.x, 5.x

Restrict available skins

Post by aph »

I would like to make the skins visible in agent preference based on roles. For example, I created a custom skin for the role IT following https://otrs.github.io/doc/manual/devel ... skins.html. I would like this skin to be visible only to the users with role IT (ideally, although a solution with group could also work). Where do I define the restriction in the xml of the custom skin file?

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<otrs_config version="1.0" init="Framework">
    <ConfigItem Name="AgentLogo" Required="0" Valid="1">
        <Description Translatable="1">The logo shown in the header of the agent interface. The URL to the image must be a relative URL to the skin image directory.</Description>
        <Group>Framework</Group>
        <SubGroup>Frontend::Agent</SubGroup>
        <Setting>
            <Hash>
                <Item Key="URL">skins/Agent/custom/img/logo.png</Item>
                <Item Key="StyleTop">13px</Item>
                <Item Key="StyleRight">75px</Item>
                <Item Key="StyleHeight">67px</Item>
                <Item Key="StyleWidth">244px</Item>
            </Hash>
        </Setting>
    </ConfigItem>
    <ConfigItem Name="Loader::Agent::Skin###100-custom" Required="0" Valid="1">
        <Description Translatable="1">Custom skin for the development manual.</Description>
        <Group>Framework</Group>
        <SubGroup>Frontend::Agent</SubGroup>
        <Setting>
            <Hash>
                <Item Key="InternalName">custom</Item>
                <Item Key="VisibleName">Custom</Item>
                <Item Key="Description">Custom skin for the development manual.</Item>
                <Item Key="HomePage">www.yourcompany.com</Item>
            </Hash>
        </Setting>
    </ConfigItem>
</otrs_config>
OTRS 3.3.x (private/testing) on Windows Server 2008 with MSSQL database.
OTRS 3.3.x (private/testing) on CentOS with MySQL database and apache
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Restrict available skins

Post by RStraub »

Usually that is an entry called "Group", but I do not know if that value is evaluated in the perl file in the same way as other restrictions are evaluated.
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
aph
Znuny superhero
Posts: 646
Joined: 20 Jun 2014, 12:11
Znuny Version: 3.3.9, 4.x, 5.x

Re: Restrict available skins

Post by aph »

I edited the file as follows
<ConfigItem Name="Loader::Agent::Skin###100-custom" Required="0" Valid="1">
<Description Translatable="1">Custom skin for the development manual.</Description>
<Group>Framework</Group>
<SubGroup>Frontend::Agent</SubGroup>
<Setting>
<Hash>
<Item Key="InternalName">custom</Item>
<Item Key="VisibleName">Custom</Item>
<Item Key="Description">Custom skin for the development manual.</Item>
<Item Key="HomePage">www.yourcompany.com</Item>
<Item Key="Group">IT</Item>
</Hash>
</Setting>
</ConfigItem>
But, the skin is visible to users who are not member of the group IT.
OTRS 3.3.x (private/testing) on Windows Server 2008 with MSSQL database.
OTRS 3.3.x (private/testing) on CentOS with MySQL database and apache
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Restrict available skins

Post by RStraub »

The only thing that happens is the ValidateSkin function from the LayoutLoader. And that function does not restrict skins based on a group. So you are out of luck I guess.

You could maybe hide the field Skins from the Agentpreferences and manually set the Skin for each Agent. I highly doubt that is worth it though :)
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
aph
Znuny superhero
Posts: 646
Joined: 20 Jun 2014, 12:11
Znuny Version: 3.3.9, 4.x, 5.x

Re: Restrict available skins

Post by aph »

Well then I guess I can't stop users from selecting a skin not intended for them ;)
OTRS 3.3.x (private/testing) on Windows Server 2008 with MSSQL database.
OTRS 3.3.x (private/testing) on CentOS with MySQL database and apache
Locked