Exemplo n.º 1
0
        public ImpulseDescriptor Impulse(string name, LocalizedString caption = null, LocalizedString description = null)
        {
            if (!Impulses.ContainsKey(name))
            {
                Impulses[name] = new ImpulseDescriptor(name);
            }
            var impulse = Impulses[name];

            if (caption != null)
            {
                impulse.Caption = caption;
            }
            if (description != null)
            {
                impulse.Description = description;
            }
            return(impulse);
        }
Exemplo n.º 2
0
        protected bool CheckDescriptor(ImpulseDescriptor impulse, IContent content, object data = null)
        {
            var user = Services.WorkContext.CurrentUser;

            // Check permissions
            if (impulse.Permissions.Any(p => !_authorizationService.TryCheckAccess(p, user, content)))   //, T("Unable to perform action")))) {
            {
                return(false);
            }
            if (content != null)
            {
                if (impulse.ContentTypes.Any() && !impulse.ContentTypes.Contains(content.ContentItem.ContentType))
                {
                    return(false);
                }
                if (impulse.ContentFilters.Any(f => !f(content)))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 3
0
 public ImpulseDisplayContext(ImpulseDescriptor impulse)
 {
     _impulseDescriptor = impulse;
     Impulses           = new List <IImpulse>();
 }