Log4net Custom level - log4net

I am trying to print custom level logs in my application using log4net. I need to create my own levels like ApplicationName.Info, ApplicationName.Error
I don't know how to create custom levels for all default levels can anyone help me?

You seem to be doing this for the wrong reasons. Quoting log4j docs' faq:
It is possible, but rarely appropriate. [..]
It's absolutely overkill and needless work to override the already existing log-levels with custom ones. Log frameworks generally allow configuring templates according to your needs.
Use the existing levels instead, anything else is probably not the correct approach to your current problem.

Related

How to implement ABAC- Attribute Based Access Control in nodejs? Is it good / fit for small and large scale application?

How I can implement ABAC in nodejs. I want to give access to user using his location and role.
any one have demo for it?
I am refering npm package PolicyLine: npm i policyline refer link - https://www.npmjs.com/package/policyline
Even though this question is a bit old, I still want to give some answer for other users, which have the same or similar question in mind.
To answer your initial question:
It depends on your requirements and application. If you need to hide or show some fields based on permissions and roles, you should go with ABAC. If you just want to do permissions based on models/entities then a simple ACL would work or even just some predefined roles in a simple domain.
So usually you know what you need. Depending on the application one solution (or library) can be totally fine/overkill and in another it is just enough.
BTW:
I also can recommend https://casl.js.org/ which is actively maintained and also offers ABAC (including time based permission checks).

What is the easiest way to setup human translations through a third-party service with Contentful?

I'm interested in setting up human translation workflows with Contentful through a third-party service like Smartling or Straker. What would be the easiest way to do this?
I don't believe there's anything supported. You're going to want to get the content into XLIFF.
https://en.wikipedia.org/wiki/XLIFF
Write a process to output as XLIFF, and another process to update from XLIFF. But, understand that you're breaking new ground here.

Liferay JMX beans

I need to plan monitoring of Liferay 6.1 running on Glassfish 3.1.2. So far we determined Glassfish mbans we want to monitor.
The question is:
does Liferay provide any MBeans in addittion to those provided by app server (liferay specific mbans) ?
if so, are there any industry standard liferay mbeans that are worth to monitor in general ?
References to existing Liferay docs are welcome (actually may suffice for the whole answer). So far I could not find anything in official docs.
Thanks !
I doubt that you'll find "industry standard" mbeans, as Liferay is a platform that is used in many completely different ways: E.g. you might want to monitor the MessageBoards caches if you have a forum-like installation that suffers performance in that area. If you don't have enough content of a specific type, it doesn't make sense to monitor that cache.
That being said, from the top of my head I remember that the caches are available for your monitoring.
My recommendation is to browse through the MBeans and figure out if the given values make sense for your installation and usecase. They do have quite descriptive names.
Also, keep in mind that in general production you'll monitor other values than e.g. during performance tuning. (Coming back to caches: It makes sense to dimension the caches according to their actual size - but they wouldn't vary greatly day to day. So looking at them manually - when you want to change some config - makes sense

DDD. Where do user configurable settings belong?

I'm working on my first "real" DDD application.
Currently my client does not have access to my domain layer and requests changes to the domain by issuing commands.
I then have a separate (flattened) read model for displaying information (like simple CQRS).
I'm now working on configuration, or specifically, settings that the user configures. Using a blog application as an example, the settings might be the blog title or logo.
I've developed a generic configuration builder that builds a strongly typed configuration object (e.g. BlogSettings) based on a simple key value pair collection. I'm stuck on whether these configuration objects are part of my domain. I need access to them from the client and server.
I'm considering creating a "Shared" library that contains these configuration objects. Is this the correct approach?
Finally where should the code to save such configuration settings live? An easy solution would be to put this code in my Domain.Persistence project, but then, if they are not part of the domain, should they really be there?
Thanks,
Ben
User configurable settings belong to domain if they are strongly typed and modeled based on ubiquitous language, i.e. 'BlogSettings'. The only difference between settings and other domain objects is that conceptually settings are 'domain singletons'. They don't have a life cycle like other Entities and you can only have one instance.
Generic configuration builder belongs to Persistence just like the code that is responsible for saving and reading settings.
Having found this question, I feel obliged to suggest an answer because I don't like the accepted one.
First off I don't see why this has to be a singleton.
Secondly, there is something about settings that is very important: they are usually hierarchical, and they almost always have to have the concept of defaults. Sometimes those defaults are at the item level. Other times you might prefer to replicate a whole set of defaults. Also, consider the fact that settings can use the concept of inheritance: maybe an agency has a setting, but it permits agents the ability to do their own.

More Than 32 Roles/Permissions Symfony2 Security System?

Everything in Symfony2 looks pretty good however there is one issue I can't seem to find a solution too. The issue is that Symfony2's security component is limited to 30-32 roles/permissions. One of my projects, a project management/issue tracker system, is going to need more than 32 permissions. There are a number of different components of the system that need to have there own set of permissions. Just because someone has create, read, update, or delete permissions to issues does not mean they have those permissions for projects, milestones, etc... Each component is going to need its own create, read, update, and delete permission not to mention component specific permissions and there is no doubt I will reach the 30-32 roles/permission limit.
I have questioned in IRC and the mailing list with no really direction of where to go. I would prefer to be able to just added this functionality on top of the existing security component (preferably through a bundle). I am not sure how I can achieve more than 30-32 roles/permissions with symfony2's security component.
I would really prefer not to have to development my own security system w/ ACL.
as stated before in the question comments by gilden:
But this is exactly the use case for ACL. You can start using the built-in ACL system today! It's quite easy to modify/extend as well to best suit your needs.
For beginners, I think it's best to read these articles from Symfony2 official book in the following order:
Security - Including info about: Authentication and Authorization, Users & Roles, Access Control in Templates & Controllers
Access Control Lists (ACLs) - Including info about: Bootstrapping & configuration, Creating an ACL, an ACE, Checking Access & Cumulative Permissions
Advanced ACL Concepts - Including info about: Design Concepts, Database Table Structure, Scope, Pre- & Post-Authorization Decisions, Process for Reaching Authorization Decisions
There are also some interesting question here at SO.com about Symfony2 ACLs
Good luck!
I think you kind of misunderstood the acl system you can only create 32 kind of role, but by domain object. This is done using bitmasks operations on integers ( this explaining the '32' limitation as an integer is ... well you know the answer ).
So for example the permission to delete one object would be same - 'MASK_DELETE' - for a project a milestone or a ticket. So if you used the ProblematicAclManagerBundle you would just have to do :
$aclManager->addPermission($ticket, $userEntity, MaskBuilder::MASK_DELETE);
or
$aclManager->addPermission($projet, $userEntity, MaskBuilder::MASK_DELETE);
to give your user permission to delete $project or $ticket for instance. It also creates the acl entry for the domain object and the entry for the user if they are not already there. What I need to know though is if you can create different masks names for a class, or every class of a bundle ?
You will find a deeper explaination on acls here
I know this is an old post, but I just wanted to share this with anyone who has a similar answer.
The key to providing a solution is in this sentence in your question:
There are a number of different components of the system that need to have there own set of permissions.
For each of these components you could create a separate voter.
Create a class that extends AclVoter.
Override the supportsClass() method to make sure the voter will only vote for classes of the component it is meant for.
Create your own PermissionMap containing the set of permissions the component needs.
Pass the PermissionMap to the AclVoter in your services configuration.
Tag the voter as security.voter so the AccessDecisionManager will start using it.
This should get you a long way.
I also recommend going thought the code of the ACL Component, there are a lot of features that unfortunately aren't documented.

Resources