예제 #1
0
        public static Permission ToCoreModel(this dataModel.PermissionEntity source)
        {
            var result = new Permission();
            result.InjectFrom(source);

            return result;
        }
 public static Permission ToCoreModel(this dataModel.RolePermissionEntity source, IPermissionScopeService scopeService)
 {
     var result = new Permission();
     result.InjectFrom(source.Permission);
     result.AssignedScopes = source.Scopes.Select(x => new { source = x, target = scopeService.GetScopeByTypeName(x.Type) })
                                           .Where(x=> x.target != null)
                                           .Select(x=> x.source.ToCoreModel(x.target))
                                           .ToArray();
     result.AvailableScopes = scopeService.GetAvailablePermissionScopes(result.Id).ToArray();
     return result;
 }