changeset 585:dfa90fbc05bd

Group admin can edit any blog attributes.
author HIROSE Yuuji <yuuji@gentei.org>
date Thu, 15 Aug 2019 17:09:16 +0900
parents 1974f3bce999
children a03bfd5d242a
files s4-blog.sh s4-funcs.sh
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/s4-blog.sh	Sat Jul 27 08:54:43 2019 +0900
+++ b/s4-blog.sh	Thu Aug 15 17:09:16 2019 +0900
@@ -195,7 +195,9 @@
 
   query<<-EOF |
 	SELECT coalesce((SELECT "yes" FROM blog
-			 WHERE rowid=$rowid AND author='$user'),
+			-- GrpAdmin CAN EDIT heading since 2019-08-15
+			 WHERE '$isgrpadmin' = 'true'
+			       OR (rowid=$rowid AND author='$user')),
 			 ''),
 	       max(CASE key WHEN 'ctime' THEN val END) ctime,
 	       max(CASE key WHEN 'heading' THEN hex(val) END) heading,
--- a/s4-funcs.sh	Sat Jul 27 08:54:43 2019 +0900
+++ b/s4-funcs.sh	Thu Aug 15 17:09:16 2019 +0900
@@ -3339,6 +3339,14 @@
       sql="select gname from $tbl where rowid=$rowid;"
       ##err p2t:grp:q $sql
       isgrpowner "$user" "`query $sql`" && rowowner=$user
+    elif [ x"$tbl" = x"blog" ]; then
+      # Check if owner in blog_s
+      blogowner=`getvalbyid blog owner "$rowid"`
+      if isgrpowner "$user" "$blogowner"; then
+	rowowner=$user
+      else
+	rowowner=`query "SELECT author FROM $tbl WHERE rowid=$rowid;"`
+      fi
     else
       # 2016-12-05 There's no owner column in $tbl (need confirmation)
       rowowner=`query "SELECT author FROM $tbl WHERE rowid=$rowid;"`

yatex.org