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;
            }
        }