Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Security.ADODataAccess/3.2/PermissionAdapter.cs @ 1656

Last change on this file since 1656 was 1656, checked in by svonolfe, 15 years ago

Implemented large parts of the security DAL (#597)

File size: 2.2 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using HeuristicLab.DataAccess.ADOHelper;
6using HeuristicLab.Security.Contracts.BusinessObjects;
7using HeuristicLab.Security.DataAccess;
8using HeuristicLab.Security.ADODataAccess.TableAdapterWrapper;
9
10namespace HeuristicLab.Security.ADODataAccess {
11  class PermissionAdapter: DataAdapterBase<
12      dsSecurityTableAdapters.PermissionTableAdapter,
13      Permission,
14      dsSecurity.PermissionRow>,
15      IPermissionAdapter {
16    public PermissionAdapter() :
17      base(new PermissionAdapterWrapper()) {
18    }
19
20    protected override dsSecurity.PermissionRow ConvertObj(Permission perm,
21      dsSecurity.PermissionRow row) {
22      if (row != null && perm != null) {
23        row.PermissionId = perm.Id;
24        row.Name = perm.Name;
25        row.Description = perm.Description;
26        row.Plugin = perm.Plugin;
27
28        return row;
29      } else {
30        return null;
31      }
32    }
33
34    protected override Permission ConvertRow(dsSecurity.PermissionRow row,
35      Permission perm) {
36      if (row != null && perm != null) {
37        perm.Id = row.PermissionId;
38        if (!row.IsNameNull())
39          perm.Name = row.Name;
40        else
41          perm.Name = String.Empty;
42
43        if (!row.IsDescriptionNull())
44          perm.Description = row.Description;
45        else
46          perm.Description = String.Empty;
47
48        if (!row.IsPluginNull())
49          perm.Plugin = row.Plugin;
50        else
51          perm.Plugin = String.Empty;
52
53        return perm;
54      } else {
55        return null;
56      }
57    }
58
59    #region IPermissionAdapter Members
60
61    public GrantedPermission getPermission(PermissionOwner permissionOwner,
62      Permission permission,
63      Guid entityId) {
64      throw new NotImplementedException();
65    }
66
67    public bool grantPermission(Guid permissionOwnerId,
68      Guid permissionId,
69      Guid entityId) {
70      throw new NotImplementedException();
71    }
72
73    public bool revokePermission(Guid permissionOwnerId,
74      Guid permissionId,
75      Guid entityId) {
76      throw new NotImplementedException();
77    }
78
79    #endregion
80  }
81}
Note: See TracBrowser for help on using the repository browser.