add "self" to access control lists with special marking to indicate it's special (for instance you can't really deny access to yourself). But this lets us make something private to our eyes only; whatever it may be.

This commit is contained in:
friendica 2014-01-06 17:10:53 -08:00
parent 8dc22c564a
commit 41df51a815
3 changed files with 10 additions and 6 deletions

View file

@ -51,7 +51,7 @@ function acl_init(&$a){
$r = q("SELECT COUNT(abook_id) AS c FROM abook left join xchan on abook_xchan = xchan_hash $r = q("SELECT COUNT(abook_id) AS c FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d AND not ( abook_flags & %d ) and not (xchan_flags & %d ) $sql_extra2" , WHERE abook_channel = %d AND not ( abook_flags & %d ) and not (xchan_flags & %d ) $sql_extra2" ,
intval(local_user()), intval(local_user()),
intval(ABOOK_FLAG_SELF|ABOOK_FLAG_BLOCKED|ABOOK_FLAG_PENDING|ABOOK_FLAG_ARCHIVED), intval(ABOOK_FLAG_BLOCKED|ABOOK_FLAG_PENDING|ABOOK_FLAG_ARCHIVED),
intval(XCHAN_FLAGS_DELETED) intval(XCHAN_FLAGS_DELETED)
); );
$contact_count = (int)$r[0]['c']; $contact_count = (int)$r[0]['c'];
@ -127,11 +127,11 @@ function acl_init(&$a){
} }
if ($type=='' || $type=='c') { if ($type=='' || $type=='c') {
$r = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms $r = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms, abook_flags
FROM abook left join xchan on abook_xchan = xchan_hash FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d AND not ( abook_flags & %d ) and not (xchan_flags & %d ) $sql_extra2 order by xchan_name asc" , WHERE abook_channel = %d AND not ( abook_flags & %d ) and not (xchan_flags & %d ) $sql_extra2 order by xchan_name asc" ,
intval(local_user()), intval(local_user()),
intval(ABOOK_FLAG_SELF|ABOOK_FLAG_BLOCKED|ABOOK_FLAG_PENDING|ABOOK_FLAG_ARCHIVED), intval(ABOOK_FLAG_BLOCKED|ABOOK_FLAG_PENDING|ABOOK_FLAG_ARCHIVED),
intval(XCHAN_FLAGS_DELETED) intval(XCHAN_FLAGS_DELETED)
); );
@ -214,7 +214,7 @@ function acl_init(&$a){
"xid" => $g['hash'], "xid" => $g['hash'],
"link" => $g['nick'], "link" => $g['nick'],
"nick" => substr($g['nick'],0,strpos($g['nick'],'@')), "nick" => substr($g['nick'],0,strpos($g['nick'],'@')),
"network" => '', "self" => (($g['abook_flags'] & ABOOK_FLAG_SELF) ? 'abook-self' : ''),
"taggable" => (($g['abook_their_perms'] & PERMS_W_TAGWALL) ? 'taggable' : '') "taggable" => (($g['abook_their_perms'] & PERMS_W_TAGWALL) ? 'taggable' : '')
); );
} }

View file

@ -259,8 +259,8 @@ ACL.prototype.populate = function(data){
var height = Math.ceil(data.tot / that.nw) * 42; var height = Math.ceil(data.tot / that.nw) * 42;
that.list_content.height(height); that.list_content.height(height);
$(data.items).each(function(){ $(data.items).each(function(){
html = "<div class='acl-list-item {4} {5} {7}' title='{6}' id='{2}{3}'>"+that.item_tpl+"</div>"; html = "<div class='acl-list-item {4} {7} {5}' title='{6}' id='{2}{3}'>"+that.item_tpl+"</div>";
html = html.format( this.photo, this.name, this.type, this.xid, '', this.network, this.link, this.taggable ); html = html.format( this.photo, this.name, this.type, this.xid, '', this.self, this.link, this.taggable );
if (this.uids!=undefined) that.group_uids[this.id] = this.uids; if (this.uids!=undefined) that.group_uids[this.id] = this.uids;
//console.log(html); //console.log(html);
that.list_content.append(html); that.list_content.append(html);

View file

@ -2441,3 +2441,7 @@ img.mail-list-sender-photo {
margin-top: 8px; margin-top: 8px;
margin-right: 15px; margin-right: 15px;
} }
.abook-self {
background-color: #ffdddd;
}