void CheckPermission(bool isUsersOwnItem = true)
        {
            var security = new ModuleSecurity(ModuleContext);

            if (
                !((!IsNewRow && security.IsAllowedToEditRow(isUsersOwnItem)) ||
                  (IsNewRow && security.IsAllowedToAddRow() && (security.IsAllowedToAdministrateModule() || HasAddPermissonByQuota()))))
            {
                if (IsNested())
                {
                    cmdUpdate.Enabled = false;

                    divForm.Visible = true;
                }
                else
                {
                    Response.Redirect(Globals.NavigateURL(ModuleContext.TabId), true);
                }
            }
            else
            {
                _hasUpdatePermission = true;
            }
            _hasDeletePermission = Convert.ToBoolean(security.IsAllowedToDeleteRow(isUsersOwnItem) && !IsNewRow);
            cmdDelete.Visible    = _hasDeletePermission;
        }
예제 #2
0
        public void EnsureActionButton()
        {
            var modSecurity = new ModuleSecurity(ModuleContext);
            var useButtons  = Settings.UseButtonsInForm;

            if (Settings.OnlyFormIsShown)
            {
                var url   = Globals.NavigateURL(ModuleContext.TabId);
                var title = Localization.GetString("BackToForm.Action", LocalResourceFile);

                ActionLink.NavigateUrl     = url;
                ActionLink.Text            = title;
                placeholderActions.Visible = useButtons;
            }
            else if (Settings.OnlyListIsShown && modSecurity.IsAllowedToAddRow() && SchemaIsDefined() &&
                     (modSecurity.IsAllowedToAdministrateModule() || HasAddPermissonByQuota()))
            {
                var url   = ModuleContext.EditUrl();
                var title = Localization.GetString(ModuleActionType.AddContent, LocalResourceFile);

                ActionLink.NavigateUrl     = url;
                ActionLink.Text            = title;
                placeholderActions.Visible = useButtons;
            }
        }
예제 #3
0
        void ShowModuleMessage(string message)
        {
            var moduleControl = GetModuleControl();
            var modSecurity   = new ModuleSecurity(ModuleContext);

            if (modSecurity.IsAllowedToAdministrateModule())
            {
                UI.Skins.Skin.AddModuleMessage(moduleControl, message, ModuleMessage.ModuleMessageType.YellowWarning);
            }
        }
예제 #4
0
        public void RaisePostBackEvent(string eventArgument)
        {
            var modSecurity = new ModuleSecurity(ModuleContext);

            if (eventArgument == "DeleteAll" && modSecurity.IsAllowedToAdministrateModule())
            {
                UdtController.DeleteRows();
                Response.Redirect(Globals.NavigateURL(ModuleContext.TabId), true);
            }
        }