Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7592


Ignore:
Timestamp:
03/09/12 17:22:38 (13 years ago)
Author:
ascheibe
Message:

#1174 added client-side security checks

Location:
branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Administration/AdministratorMenuItem.cs

    r7331 r7592  
    2121
    2222using System.Collections.Generic;
     23using System.Windows.Forms;
    2324using HeuristicLab.MainForm;
    2425using HeuristicLab.Optimizer;
     
    3738
    3839    public override void Execute() {
    39       MainFormManager.MainForm.ShowContent(AdministrationClient.Instance);
     40      if (OKBRoles.CheckAdminUserPermissions()) {
     41        MainFormManager.MainForm.ShowContent(AdministrationClient.Instance);
     42      } else {
     43        MessageBox.Show("You don't have the permissions for administrating the OKB.", "Security check failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     44      }
    4045    }
    4146  }
  • branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/HeuristicLab.Clients.OKB-3.3.csproj

    r7589 r7592  
    202202      <DependentUpon>ProblemView.cs</DependentUpon>
    203203    </Compile>
     204    <Compile Include="OKBRoles.cs" />
    204205    <Compile Include="Plugin.cs" />
    205206    <Compile Include="Query\QueryClient.cs" />
  • branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/RunCreation/CreateFromExperimentMenuItem.cs

    r7580 r7592  
    4040    protected override void OnActiveViewChanged(object sender, EventArgs e) {
    4141      IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
    42       ToolStripItem.Enabled = (activeView != null) && (activeView.Content != null) && (activeView.Content is Experiment) && !activeView.Locked;
     42      ToolStripItem.Enabled = (activeView != null) && (activeView.Content != null) && (activeView.Content is Experiment) && !activeView.Locked && OKBRoles.CheckUserPermissions();
    4343    }
    4444
  • branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/RunCreation/OKBAlgorithm.cs

    r7554 r7592  
    200200      runs = new RunCollection();
    201201      storeRunsAutomatically = true;
    202       UserId = UserInformation.Instance.User.Id;
     202      CheckUserPermissions();
    203203      RegisterRunsEvents();
     204    }
     205
     206    private void CheckUserPermissions() {
     207      if (UserInformation.Instance.UserExists) {
     208        if (UserInformation.Instance.Roles.Count(x => x.Name == OKBRoles.OKBUser || x.Name == OKBRoles.OKBAdministrator) > 0) {
     209          UserId = UserInformation.Instance.User.Id;
     210        } else {
     211          throw new Exception("You don't have the appropriate roles for executing OKB Algorithms.");
     212        }
     213      } else {
     214        throw new Exception("You need an user account for executing OKB Algorithms.");
     215      }
    204216    }
    205217
Note: See TracChangeset for help on using the changeset viewer.